MCPcopy
hub / github.com/harness/harness / parseDiffStderr

Function parseDiffStderr

git/api/diff.go:736–753  ·  view source on GitHub ↗
(stderr *bytes.Buffer)

Source from the content-addressed store, hash-verified

734}
735
736func parseDiffStderr(stderr *bytes.Buffer) error {
737 errRaw := stderr.String() // assume there will never be a lot of output to stdout
738 if len(errRaw) == 0 {
739 return nil
740 }
741
742 if idx := strings.IndexByte(errRaw, '\n'); idx > 0 {
743 errRaw = errRaw[:idx] // get only the first line of the output
744 }
745
746 errRaw = strings.TrimPrefix(errRaw, "fatal: ") // git errors start with the "fatal: " prefix
747
748 if strings.Contains(errRaw, "bad revision") {
749 return parser.ErrSHADoesNotMatch
750 }
751
752 return errors.New(errRaw)
753}

Callers 2

GetDiffHunkHeadersMethod · 0.85
diffCutFromHunkMethod · 0.85

Calls 3

NewFunction · 0.92
StringMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…