From 5c171cf8e761ad8e95741e4dbdfd18329d5c65f1 Mon Sep 17 00:00:00 2001 From: Son Luong Ngoc Date: Tue, 19 May 2020 08:43:08 +0200 Subject: [PATCH 1/3] Make build step to use git 2.25 We raised the minimum Git version to 2.25 --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6053e6c697..9f8ee62f3b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -107,7 +107,7 @@ build:go1.14: build:go1.13: <<: *build_definition - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.24 + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.25 binaries_go1.14: <<: *assemble_definition @@ -115,7 +115,7 @@ binaries_go1.14: binaries_go1.13: <<: *assemble_definition - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.24 + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.25 test:go1.14-git-2.26-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.26 -- GitLab From 19ba837227e536742479a80278d4d9922f529cdf Mon Sep 17 00:00:00 2001 From: Son Luong Ngoc Date: Tue, 19 May 2020 08:46:00 +0200 Subject: [PATCH 2/3] Upgrade min git version to 2.25 for tests All test jobs which previously used Git 2.22 and 2.24 are now upgraded to 2.25. Removed duplicated jobs. --- .gitlab-ci.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f8ee62f3b6..04bc1e0b343 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,24 +121,16 @@ test:go1.14-git-2.26-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.26 <<: *test_definition -test:go1.14-git-2.24-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.24 - <<: *test_definition - -test:go1.14-git-2.22-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.26 +test:go1.14-git-2.25-ruby-2.6: + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.25 <<: *test_definition test:go1.13-git-2.26-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.26 <<: *test_definition -test:go1.13-git-2.24-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.22 - <<: *test_definition - -test:go1.13-git-2.22-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.24 +test:go1.13-git-2.25-ruby-2.6: + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.25 <<: *test_definition test:proxy: -- GitLab From 47799fd746039bd77f403f70d178857dc158b8f0 Mon Sep 17 00:00:00 2001 From: Son Luong Ngoc Date: Tue, 19 May 2020 08:53:24 +0200 Subject: [PATCH 3/3] Removed commitGraph explicit configurations As of git 2.24, most commitGraph configurations are set to true by default[1]. We can, therefore, deprecate the code that we used to set this configuration explicitly. Note that the test TestGarbageCollectCommitGraph in gc_test.go is still there as we might still want to test for commitGraph existence against upstream git changes. Reference: [1]: https://github.com/git/git/commit/31b1de6a09bad59cc0d88419925486afc7add277 --- internal/service/repository/gc.go | 31 -------------------------- internal/service/repository/gc_test.go | 13 ----------- 2 files changed, 44 deletions(-) diff --git a/internal/service/repository/gc.go b/internal/service/repository/gc.go index ab409985541..c79e72d6dbc 100644 --- a/internal/service/repository/gc.go +++ b/internal/service/repository/gc.go @@ -43,10 +43,6 @@ func (*server) GarbageCollect(ctx context.Context, in *gitalypb.GarbageCollectRe return nil, err } - if err := configureCommitGraph(ctx, in); err != nil { - return nil, err - } - // Perform housekeeping post GC err = housekeeping.Perform(ctx, repoPath) if err != nil { @@ -61,11 +57,6 @@ func (*server) GarbageCollect(ctx context.Context, in *gitalypb.GarbageCollectRe func gc(ctx context.Context, in *gitalypb.GarbageCollectRequest) error { args := repackConfig(ctx, in.CreateBitmap) - // run garbage collect and also write the commit graph - args = append(args, - git.ValueFlag{"-c", "gc.writeCommitGraph=true"}, - ) - cmd, err := git.SafeCmd(ctx, in.GetRepository(), args, git.SubCmd{Name: "gc"}, ) @@ -87,28 +78,6 @@ func gc(ctx context.Context, in *gitalypb.GarbageCollectRequest) error { return nil } -func configureCommitGraph(ctx context.Context, in *gitalypb.GarbageCollectRequest) error { - cmd, err := git.SafeCmd(ctx, in.GetRepository(), nil, git.SubCmd{ - Name: "config", - Flags: []git.Option{ - git.ConfigPair{"core.commitGraph", "true"}, - }, - }) - if err != nil { - if _, ok := status.FromError(err); ok { - return err - } - - return helper.ErrInternal(fmt.Errorf("GarbageCollect: config gitCommand: %v", err)) - } - - if err := cmd.Wait(); err != nil { - return helper.ErrInternal(fmt.Errorf("GarbageCollect: config cmd wait: %v", err)) - } - - return nil -} - func cleanupKeepArounds(ctx context.Context, repo *gitalypb.Repository) error { repoPath, err := helper.GetRepoPath(repo) if err != nil { diff --git a/internal/service/repository/gc_test.go b/internal/service/repository/gc_test.go index 1295e32757a..7a3cbdd26c5 100644 --- a/internal/service/repository/gc_test.go +++ b/internal/service/repository/gc_test.go @@ -50,19 +50,6 @@ func TestGarbageCollectCommitGraph(t *testing.T) { filepath.Join(testRepoPath, "objects/info/commit-graph"), "pre-computed commit-graph should exist after running garbage collect", ) - - repoCfgPath := filepath.Join(testRepoPath, "config") - - cfgF, err := os.Open(repoCfgPath) - require.NoError(t, err) - defer cfgF.Close() - - cfg, err := testhelper.ParseConfig(cfgF) - require.NoError(t, err) - - actualValue, ok := cfg.GetValue("core", "commitGraph") - require.True(t, ok) - require.Equal(t, "true", actualValue) } func TestGarbageCollectSuccess(t *testing.T) { -- GitLab