Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-08-04 10:37:07 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-08-04 10:43:12 +0300
commit8b14bc6b52f0ca20bf25a9c22abea76917a31cea (patch)
treeec0edd39bbd4c99b751eea71f6ccbaf2b1219de3
parent5ac494300c839eea0980d118d12ffb51f447c0ac (diff)
objectpool: Speed up fetches by disabling computation of forced updates
By default, git-fetch(1) will compute for every reference it's about to fetch whether the update is a forced update or a normal one. This info is used in two different ways: 1. To compute whether the branch update should be allowed in the first place. This is pointless though in the case where we ask git-fetch(1) to force all updates anyway. 2. To provide information via stdout whether the reference has been force-updated or not. This is pointless in the case where we ask git-fetch(1) to be quiet. And while this check can indeed be quite expensive and take dozens of seconds, git-fetch(1) will still perform it even when asked to be quiet and to force-update any references. Skip this computation when fetching into object pools to speed up these fetches. Changelog: fixed
-rw-r--r--internal/git/objectpool/fetch.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/git/objectpool/fetch.go b/internal/git/objectpool/fetch.go
index 0ee7d6d0a..8dcdfdee2 100644
--- a/internal/git/objectpool/fetch.go
+++ b/internal/git/objectpool/fetch.go
@@ -79,11 +79,20 @@ func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *localrepo.Repo
// megabytes when doing a mirror-sync of repos with huge numbers of
// references.
git.Flag{Name: "--no-write-fetch-head"},
+ // Disable showing forced updates, which may take a considerable
+ // amount of time to compute. We don't display any output anyway,
+ // which makes this computation kind of moot.
+ git.Flag{Name: "--no-show-forced-updates"},
},
Args: []string{originPath, objectPoolRefspec},
},
git.WithRefTxHook(o.Repo),
git.WithStderr(&stderr),
+ git.WithConfig(git.ConfigPair{
+ // Git is so kind to point out that we asked it to not show forced updates
+ // by default, so we need to ask it not to do that.
+ Key: "advice.fetchShowForcedUpdates", Value: "false",
+ }),
); err != nil {
return fmt.Errorf("fetch into object pool: %w, stderr: %q", err,
stderr.String())