diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-15 12:14:27 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-15 13:24:11 +0300 |
commit | a99108e67146e10d84dd0370db8f643501f12ef1 (patch) | |
tree | ed578c6b7b18815e227b7d818398f4c13b67c6a1 | |
parent | b76800c33ddb131ef883a88f3ddf09675b82b7ce (diff) |
git: Fix missing reverse indices for some Git commands
While most of our commands that may end up writing packfiles are set up
correctly to write reverse indices, both git-receive-pack(1) and
git-fetch(1) are missing the configuration. As a result, packfiles
written by them are missing the indices. More generally though, they're
missing all packfile-related configuration like the number of threads
they're supposed to use.
Fix this by adding the packfile configuration to both commands.
Changelog: fixed
-rw-r--r-- | internal/git/command_description.go | 8 | ||||
-rw-r--r-- | internal/git/localrepo/remote_test.go | 5 | ||||
-rw-r--r-- | internal/gitaly/service/smarthttp/receive_pack_test.go | 5 |
3 files changed, 8 insertions, 10 deletions
diff --git a/internal/git/command_description.go b/internal/git/command_description.go index c0939a704..a56580e0b 100644 --- a/internal/git/command_description.go +++ b/internal/git/command_description.go @@ -85,7 +85,7 @@ var commandDescriptions = map[string]commandDescription{ "fetch": { flags: 0, - opts: append([]GlobalOption{ + opts: append(append([]GlobalOption{ // We've observed performance issues when fetching into big repositories // part of an object pool. The root cause of this seems to be the // connectivity check, which by default will also include references of any @@ -119,7 +119,7 @@ var commandDescriptions = map[string]commandDescription{ // of time though because we never populate submodules at all. We thus // disable recursion into submodules. ConfigPair{Key: "fetch.recurseSubmodules", Value: "no"}, - }, fsckConfiguration("fetch")...), + }, fsckConfiguration("fetch")...), packConfiguration()...), }, "for-each-ref": { flags: scNoRefUpdates, @@ -215,7 +215,7 @@ var commandDescriptions = map[string]commandDescription{ }, "receive-pack": { flags: 0, - opts: append(append([]GlobalOption{ + opts: append(append(append([]GlobalOption{ // In case the repository belongs to an object pool, we want to prevent // Git from including the pool's refs in the ref advertisement. We do // this by rigging core.alternateRefsCommand to produce no output. @@ -226,7 +226,7 @@ var commandDescriptions = map[string]commandDescription{ // Make git-receive-pack(1) advertise the push options // capability to clients. ConfigPair{Key: "receive.advertisePushOptions", Value: "true"}, - }, hiddenReceivePackRefPrefixes()...), fsckConfiguration("receive")...), + }, hiddenReceivePackRefPrefixes()...), fsckConfiguration("receive")...), packConfiguration()...), }, "remote": { // While git-remote(1)'s `add` subcommand does support `--end-of-options`, diff --git a/internal/git/localrepo/remote_test.go b/internal/git/localrepo/remote_test.go index 1a0f3762b..0c622431e 100644 --- a/internal/git/localrepo/remote_test.go +++ b/internal/git/localrepo/remote_test.go @@ -205,11 +205,10 @@ func TestRepo_FetchRemote(t *testing.T) { require.NoError(t, err) require.Len(t, packfiles, 1) - // And furthermore, that packfile should have a reverse index. Due to a bug it - // doesn't though. + // And furthermore, that packfile should have a reverse index. reverseIndices, err = filepath.Glob(filepath.Join(repoPath, "objects", "pack", "*.rev")) require.NoError(t, err) - require.Empty(t, reverseIndices) + require.Len(t, reverseIndices, 1) }) } diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go index 7675ed5d0..21237a4a1 100644 --- a/internal/gitaly/service/smarthttp/receive_pack_test.go +++ b/internal/gitaly/service/smarthttp/receive_pack_test.go @@ -277,11 +277,10 @@ func TestPostReceivePack_packfiles(t *testing.T) { require.NoError(t, err) require.Len(t, packfiles, 2) - // ... and one reverse index for the newly added packfile. Due to a bug we don't generate - // the reverse index though. + // ... and one reverse index for the newly added packfile. reverseIndices, err = filepath.Glob(filepath.Join(repoPath, "objects", "pack", "*.rev")) require.NoError(t, err) - require.Empty(t, reverseIndices) + require.Len(t, reverseIndices, 1) } func TestPostReceivePack_rejectViaGitConfigOptions(t *testing.T) { |