diff options
author | David Kim <dkim@gitlab.com> | 2023-10-25 05:38:12 +0300 |
---|---|---|
committer | David Kim <dkim@gitlab.com> | 2023-10-25 05:38:12 +0300 |
commit | 1edcc70252ea1536aea25dab2f7c5f15703b4610 (patch) | |
tree | 05a550199738746788f702fbc0e08fec13cce246 | |
parent | 26f881b74697af7e2f4c7b02b83e1df07881b81c (diff) |
Return an empty string when the patch-id is empty5638-return-nil-patch_id-response-when-diff-is-missing-or-empty
-rw-r--r-- | internal/gitaly/service/diff/patch_id.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/diff/patch_id_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/internal/gitaly/service/diff/patch_id.go b/internal/gitaly/service/diff/patch_id.go index f1f1da95f..09be2827c 100644 --- a/internal/gitaly/service/diff/patch_id.go +++ b/internal/gitaly/service/diff/patch_id.go @@ -67,7 +67,7 @@ func (s *server) GetPatchID(ctx context.Context, in *gitalypb.GetPatchIDRequest) } if patchIDStdout.Len() == 0 { - return nil, structerr.NewFailedPrecondition("no difference between old and new revision") + return &gitalypb.GetPatchIDResponse{PatchId: ""}, nil } // When computing patch IDs for commits directly via e.g. `git show | git patch-id` then the second diff --git a/internal/gitaly/service/diff/patch_id_test.go b/internal/gitaly/service/diff/patch_id_test.go index c3a00b82f..255552808 100644 --- a/internal/gitaly/service/diff/patch_id_test.go +++ b/internal/gitaly/service/diff/patch_id_test.go @@ -262,7 +262,7 @@ func TestGetPatchID(t *testing.T) { OldRevision: []byte(commit), NewRevision: []byte(commit), }, - expectedErr: structerr.NewFailedPrecondition("no difference between old and new revision"), + expectedResponse: &gitalypb.GetPatchIDResponse{PatchId: ""}, } }, }, |