diff --git a/git/api/commit.go b/git/api/commit.go index d507bbc4d..592004567 100644 --- a/git/api/commit.go +++ b/git/api/commit.go @@ -189,14 +189,10 @@ func (g *Git) listCommitSHAs( output := &bytes.Buffer{} err := cmd.Run(ctx, command.WithDir(repoPath), command.WithStdout(output)) if cErr := command.AsError(err); cErr != nil && cErr.IsExitCode(128) { - if cErr.IsAmbiguousArgErr() { - return nil, errors.NotFound("reference %q is ambiguous", ref) - } - if cErr.IsBadObject() { - return nil, errors.NotFound("commit not found") + if cErr.IsAmbiguousArgErr() || cErr.IsBadObject() { + return []string{}, nil // return an empty list if reference doesn't exist } } - if err != nil { return nil, processGitErrorf(err, "failed to trigger rev-list command") }