MCPcopy Create free account
hub / github.com/bluekeyes/patch2pr / splitMessage

Function splitMessage

cmd/patch2pr/main.go:412–436  ·  view source on GitHub ↗
(m string)

Source from the content-addressed store, hash-verified

410}
411
412func splitMessage(m string) (title string, body string) {
413 s := bufio.NewScanner(strings.NewReader(m))
414
415 var b strings.Builder
416 for s.Scan() {
417 line := s.Text()
418 if strings.TrimSpace(line) == "" && title == "" {
419 title = b.String()
420 b.Reset()
421 } else {
422 if b.Len() > 0 {
423 b.WriteByte('\n')
424 }
425 b.WriteString(line)
426 }
427 }
428 if s.Err() != nil {
429 return m, ""
430 }
431
432 if title == "" {
433 return b.String(), ""
434 }
435 return title, b.String()
436}
437
438func fillHeader(h *gitdiff.PatchHeader, patchFile, message string) *gitdiff.PatchHeader {
439 if h == nil {

Callers 2

executeFunction · 0.85
fillHeaderFunction · 0.85

Calls 2

StringMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected