MCPcopy Create free account
hub / github.com/antonmedv/gitmal / verifyGitHeaderName

Function verifyGitHeaderName

pkg/gitdiff/file_header.go:470–483  ·  view source on GitHub ↗

verifyGitHeaderName checks a parsed name against state set by previous lines

(parsed, existing string, isNull bool, side string)

Source from the content-addressed store, hash-verified

468
469// verifyGitHeaderName checks a parsed name against state set by previous lines
470func verifyGitHeaderName(parsed, existing string, isNull bool, side string) error {
471 if existing != "" {
472 if isNull {
473 return fmt.Errorf("expected %s, but filename is set to %s", devNull, existing)
474 }
475 if existing != parsed {
476 return fmt.Errorf("inconsistent %s filename", side)
477 }
478 }
479 if isNull && parsed != devNull {
480 return fmt.Errorf("expected %s", devNull)
481 }
482 return nil
483}
484
485// cleanName removes double slashes and drops prefix segments.
486func cleanName(name string, drop int) string {

Callers 2

parseGitHeaderOldNameFunction · 0.85
parseGitHeaderNewNameFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected