MCPcopy Index your code
hub / github.com/harness/harness / DiffShortStat

Method DiffShortStat

git/api/diff.go:305–331  ·  view source on GitHub ↗
(
	ctx context.Context,
	repoPath string,
	baseRef string,
	headRef string,
	useMergeBase bool,
	ignoreWhitespace bool,
)

Source from the content-addressed store, hash-verified

303}
304
305func (g *Git) DiffShortStat(
306 ctx context.Context,
307 repoPath string,
308 baseRef string,
309 headRef string,
310 useMergeBase bool,
311 ignoreWhitespace bool,
312) (DiffShortStat, error) {
313 if repoPath == "" {
314 return DiffShortStat{}, ErrRepositoryPathEmpty
315 }
316 separator := ".."
317 if useMergeBase {
318 separator = "..."
319 }
320
321 shortstatArgs := []string{baseRef + separator + headRef}
322 if len(baseRef) == 0 || baseRef == types.NilSHA {
323 shortstatArgs = []string{sha.EmptyTree.String(), headRef}
324 }
325 stat, err := GetDiffShortStat(ctx, repoPath, ignoreWhitespace, shortstatArgs...)
326 if err != nil {
327 return DiffShortStat{}, processGitErrorf(err, "failed to get diff short stat between %s and %s",
328 baseRef, headRef)
329 }
330 return stat, nil
331}
332
333// GetDiffHunkHeaders for each file in diff output returns file name (old and new to detect renames),
334// and all hunk headers. The diffs are generated with unified=0 parameter to create minimum sized hunks.

Callers

nothing calls this directly

Calls 3

GetDiffShortStatFunction · 0.85
processGitErrorfFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected