MCPcopy Index your code
hub / github.com/antonmedv/gitmal / scanMessageTitle

Function scanMessageTitle

pkg/gitdiff/patch_header.go:299–319  ·  view source on GitHub ↗
(s *bufio.Scanner)

Source from the content-addressed store, hash-verified

297}
298
299func scanMessageTitle(s *bufio.Scanner) (title string, indent string) {
300 var b strings.Builder
301 for i := 0; s.Scan(); i++ {
302 line := s.Text()
303 trimLine := strings.TrimSpace(line)
304 if trimLine == "" {
305 break
306 }
307
308 if i == 0 {
309 if start := strings.IndexFunc(line, func(c rune) bool { return !unicode.IsSpace(c) }); start > 0 {
310 indent = line[:start]
311 }
312 }
313 if b.Len() > 0 {
314 b.WriteByte(' ')
315 }
316 b.WriteString(trimLine)
317 }
318 return b.String(), indent
319}
320
321func scanMessageBody(s *bufio.Scanner, indent string, separateAppendix bool) (string, string) {
322 // Body and appendix

Callers 1

parseHeaderPrettyFunction · 0.85

Calls 3

WriteByteMethod · 0.80
WriteStringMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected