Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-10-12 11:46:39 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-10-15 14:48:12 +0300
commit831cb43987a98e817ce88d5c0b26ad345c07418b (patch)
tree741ad6257199d61b554e576c519340ff6b36d796
parent957f36666b8207882754a675ed9919dad7c2bb01 (diff)
git2go: Improve error messages when looking up commits
The current error messages when lookup of commits fails doesn't give any hint what reference was actually looked up, which makes it harder than necessary to understand the context. Fix this by adding the reference name to those error messages.
-rw-r--r--cmd/gitaly-git2go/util.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/gitaly-git2go/util.go b/cmd/gitaly-git2go/util.go
index d580582cd..a315c5f3a 100644
--- a/cmd/gitaly-git2go/util.go
+++ b/cmd/gitaly-git2go/util.go
@@ -11,17 +11,17 @@ import (
func lookupCommit(repo *git.Repository, ref string) (*git.Commit, error) {
object, err := repo.RevparseSingle(ref)
if err != nil {
- return nil, fmt.Errorf("could not lookup reference: %w", err)
+ return nil, fmt.Errorf("could not lookup reference %q: %w", ref, err)
}
peeled, err := object.Peel(git.ObjectCommit)
if err != nil {
- return nil, fmt.Errorf("could not peel reference: %w", err)
+ return nil, fmt.Errorf("could not peel reference %q: %w", ref, err)
}
commit, err := peeled.AsCommit()
if err != nil {
- return nil, fmt.Errorf("could not cast to commit: %w", err)
+ return nil, fmt.Errorf("reference %q is not a commit: %w", ref, err)
}
return commit, nil