diff options
author | John Cai <jcai@gitlab.com> | 2019-07-09 02:15:07 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-07-09 02:56:44 +0300 |
commit | 05536e3af4ac77a7a84fe877d80f2e30527fde79 (patch) | |
tree | 6ff6f4b9ec3be4f9ec9e2b78198c516dacbb95e4 | |
parent | 46856e1fd24d25f22289beefa472736aadc38652 (diff) |
Do not add linked repos as remotes on pool repository
-rw-r--r-- | changelogs/unreleased/jc-remove-remotes-for-object-pool.yml | 5 | ||||
-rw-r--r-- | internal/git/objectpool/link.go | 11 | ||||
-rw-r--r-- | internal/git/objectpool/link_test.go | 4 | ||||
-rw-r--r-- | internal/service/objectpool/link_test.go | 4 |
4 files changed, 9 insertions, 15 deletions
diff --git a/changelogs/unreleased/jc-remove-remotes-for-object-pool.yml b/changelogs/unreleased/jc-remove-remotes-for-object-pool.yml new file mode 100644 index 000000000..625879211 --- /dev/null +++ b/changelogs/unreleased/jc-remove-remotes-for-object-pool.yml @@ -0,0 +1,5 @@ +--- +title: Do not add linked repos as remotes on pool repository +merge_request: 1356 +author: +type: other diff --git a/internal/git/objectpool/link.go b/internal/git/objectpool/link.go index 731081b8f..ad3cfbc5f 100644 --- a/internal/git/objectpool/link.go +++ b/internal/git/objectpool/link.go @@ -34,17 +34,6 @@ func (o *ObjectPool) Link(ctx context.Context, repo *gitalypb.Repository) error return err } - remoteName := repo.GetGlRepository() - for k, v := range map[string]string{ - fmt.Sprintf("remote.%s.url", remoteName): relPath, - fmt.Sprintf("remote.%s.fetch", remoteName): fmt.Sprintf("+refs/*:refs/remotes/%s/*", remoteName), - fmt.Sprintf("remote.%s.tagOpt", remoteName): "--no-tags", - } { - if err := o.setConfig(ctx, k, v); err != nil { - return err - } - } - expectedContent := filepath.Join(relPath, "objects") actualContent, err := ioutil.ReadFile(altPath) diff --git a/internal/git/objectpool/link_test.go b/internal/git/objectpool/link_test.go index 8b5dd6612..84f6d0d0a 100644 --- a/internal/git/objectpool/link_test.go +++ b/internal/git/objectpool/link_test.go @@ -46,7 +46,7 @@ func TestLink(t *testing.T) { require.Equal(t, content, newContent) - require.True(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GetGlRepository()), "pool remotes should include %v", testRepo) + require.False(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GetGlRepository()), "pool remotes should not include %v", testRepo) } func TestLinkRemoveBitmap(t *testing.T) { @@ -113,7 +113,7 @@ func TestUnlink(t *testing.T) { require.NoError(t, pool.Create(ctx, testRepo), "create pool") require.NoError(t, pool.Link(ctx, testRepo), "link test repo to pool") - require.True(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GetGlRepository()), "pool remotes should include %v", testRepo) + require.False(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GetGlRepository()), "pool remotes should include %v", testRepo) require.NoError(t, pool.Unlink(ctx, testRepo), "unlink repo") require.False(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GetGlRepository()), "pool remotes should no longer include %v", testRepo) diff --git a/internal/service/objectpool/link_test.go b/internal/service/objectpool/link_test.go index 28bf3e9f6..9dfe55ae3 100644 --- a/internal/service/objectpool/link_test.go +++ b/internal/service/objectpool/link_test.go @@ -222,8 +222,8 @@ func TestUnlink(t *testing.T) { require.NoError(t, pool2.Create(ctx, testRepo), "create pool 2") defer pool2.Remove(ctx) - require.True(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GlRepository), "sanity check: remote exists in pool") - require.True(t, testhelper.RemoteExists(t, pool.FullPath(), deletedRepo.GlRepository), "sanity check: remote exists in pool") + require.False(t, testhelper.RemoteExists(t, pool.FullPath(), testRepo.GlRepository), "sanity check: remote exists in pool") + require.False(t, testhelper.RemoteExists(t, pool.FullPath(), deletedRepo.GlRepository), "sanity check: remote exists in pool") testCases := []struct { desc string |