diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-07-16 16:03:07 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2019-07-16 16:03:07 +0300 |
commit | b52d9ceab4603724b748f4911e2ad77e6501b5a0 (patch) | |
tree | 97951a029c9a2ae231927d3b7dcbbc1c4f5401a4 | |
parent | 313a4cb5bd6d3b7f9927e3fcb5f60d4dd050e1d4 (diff) | |
parent | 0dd443615adf3b11c27b421edf350b141e2307c7 (diff) |
Merge branch 'zj-bump-git-version-test-matrix' into 'master'
Add Git 2.22 to the test pipeline
See merge request gitlab-org/gitaly!1359
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | changelogs/unreleased/zj-bump-git-version-test-matrix.yml | 5 | ||||
-rw-r--r-- | internal/git/proto.go | 13 | ||||
-rw-r--r-- | internal/service/smarthttp/upload_pack_test.go | 9 |
5 files changed, 31 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68d2efbc5..54137a851 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,6 +97,10 @@ binaries_go1.11: <<: *assemble_definition image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.11-git-2.21 +test:go1.12-git-2.22-ruby-2.6: + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.22 + <<: *test_definition + test:go1.12-git-2.21-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.21 <<: *test_definition @@ -58,7 +58,7 @@ Gitaly requires Go 1.11.4 or newer and Ruby 2.5. Run `make` to download and compile Ruby dependencies, and to compile the Gitaly Go executable. -Gitaly uses `git`. Version `2.21.0` or higher is required. +Gitaly uses `git`. Versions `2.21.0` and `2.22.0` are supported. ## Configuration diff --git a/changelogs/unreleased/zj-bump-git-version-test-matrix.yml b/changelogs/unreleased/zj-bump-git-version-test-matrix.yml new file mode 100644 index 000000000..368737655 --- /dev/null +++ b/changelogs/unreleased/zj-bump-git-version-test-matrix.yml @@ -0,0 +1,5 @@ +--- +title: Add support for Git 2.22 +merge_request: 1359 +author: +type: added diff --git a/internal/git/proto.go b/internal/git/proto.go index dfe112311..5244e6bdb 100644 --- a/internal/git/proto.go +++ b/internal/git/proto.go @@ -148,6 +148,19 @@ func SupportsDeltaIslands(versionStr string) (bool, error) { return !versionLessThan(v, version{2, 20, 0}), nil } +// NoMissingWantErrMessage checks if the git version is before Git 2.22, +// in which versions the missing objects in the wants didn't yield an explicit +// error message, but no ouput at all. +func NoMissingWantErrMessage() bool { + ver, err := Version() + if err != nil { + return false + } + + lt, err := VersionLessThan(ver, "2.22.0") + return err == nil && lt +} + // BuildGitOptions helps to generate options to the git command. // If gitOpts is not empty then its values are passed as part of // the "-c" option of the git command, the other values are passed along with the subcommand. diff --git a/internal/service/smarthttp/upload_pack_test.go b/internal/service/smarthttp/upload_pack_test.go index a4a496c83..07dad6531 100644 --- a/internal/service/smarthttp/upload_pack_test.go +++ b/internal/service/smarthttp/upload_pack_test.go @@ -144,7 +144,14 @@ func TestUploadPackRequestWithGitConfigOptions(t *testing.T) { rpcRequest.GitConfigOptions = []string{"uploadpack.hideRefs=refs/hidden"} response, err = makePostUploadPackRequest(t, serverSocketPath, rpcRequest, requestBodyCopy) testhelper.RequireGrpcError(t, err, codes.Unavailable) - assert.Equal(t, response.String(), "", "Ref is hidden so no response should be received") + + // Remove the if clause if support is dropped for Git versions before 2.22 + if git.NoMissingWantErrMessage() { + assert.Equal(t, "", response.String(), "Ref is hidden so no response should be received") + } else { + expected := fmt.Sprintf("0049ERR upload-pack: not our ref %v", want) + assert.Equal(t, expected, response.String(), "Ref is hidden, expected error message did not appear") + } } func TestUploadPackRequestWithGitProtocol(t *testing.T) { |