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>2022-07-21 13:45:26 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-21 13:45:26 +0300
commitc5786dc5703ce093cc2438d44fa3b4273fa312de (patch)
tree117e75bda34e491efea5de5225d4b1b82cc6860f
parentf8e688fbf64938cf8563f765c040af39f33e0790 (diff)
parent798a57d8e9e731489ea9c47051d29b1ebcaf699b (diff)
Merge branch '4366-findtag-returns-an-internal-error-code-when-it-cannot-find-a-specific-tag' into 'master'
Change FindTag err when tag not found to NotFound Closes #4366 See merge request gitlab-org/gitaly!4735
-rw-r--r--internal/gitaly/service/ref/refs.go2
-rw-r--r--internal/gitaly/service/ref/refs_test.go12
2 files changed, 13 insertions, 1 deletions
diff --git a/internal/gitaly/service/ref/refs.go b/internal/gitaly/service/ref/refs.go
index 19e532dc0..c8b1ba34d 100644
--- a/internal/gitaly/service/ref/refs.go
+++ b/internal/gitaly/service/ref/refs.go
@@ -257,7 +257,7 @@ func (s *server) findTag(ctx context.Context, repo git.RepositoryExecutor, tagNa
return nil, err
}
} else {
- return nil, errors.New("no tag found")
+ return nil, helper.ErrNotFoundf("no tag found")
}
if err = tagCmd.Wait(); err != nil {
diff --git a/internal/gitaly/service/ref/refs_test.go b/internal/gitaly/service/ref/refs_test.go
index aa4e0faff..2028563e9 100644
--- a/internal/gitaly/service/ref/refs_test.go
+++ b/internal/gitaly/service/ref/refs_test.go
@@ -1212,3 +1212,15 @@ func TestInvalidFindTagRequest(t *testing.T) {
})
}
}
+
+func TestNotFoundFindTagRequest(t *testing.T) {
+ t.Parallel()
+
+ ctx := testhelper.Context(t)
+ _, repoProto, _, client := setupRefService(ctx, t)
+
+ rpcRequest := &gitalypb.FindTagRequest{Repository: repoProto, TagName: []byte("not-found")}
+
+ _, err := client.FindTag(ctx, rpcRequest)
+ testhelper.RequireGrpcError(t, err, helper.ErrNotFoundf("no tag found"))
+}