From 0aa1358d85745ee542a29787aa20d35fd2848b2e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 4 Oct 2025 23:30:58 -0500 Subject: error handling in git diff --- shell.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shell.go') diff --git a/shell.go b/shell.go index d9c7bcd..54b34c9 100644 --- a/shell.go +++ b/shell.go @@ -178,14 +178,14 @@ func (repo *Repo) ConstructGitDiffLog(branch1, branch2 string) []string { } // count all objects only in branch1 -func (repo *Repo) CountDiffObjects(branch1, branch2 string) int { +func (repo *Repo) CountDiffObjects(branch1, branch2 string) (int, error) { cmd := repo.ConstructGitDiffLog(branch1, branch2) r, err := repo.RunVerboseOnError(cmd) if err != nil { - return -1 + return -1, err } // log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " ")) - return len(r.Stdout) + return len(r.Stdout), err } func (repo *Repo) RunPipe(cmd1 []string, cmd2 []string) cmd.Status { -- cgit v1.2.3