diff options
author | Eric Wong <e@80x24.org> | 2023-02-12 10:04:26 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-27 18:27:03 +0100 |
commit | c6ce27ab08d30dd9d626d7a56cb928bc5792eb27 (patch) | |
tree | db78da0e93422555f1e18788c91f2e5aaa64a2ff /builtin/fetch.c | |
parent | A few more topics post 2.40-rc0 (diff) | |
download | git-c6ce27ab08d30dd9d626d7a56cb928bc5792eb27.tar.xz git-c6ce27ab08d30dd9d626d7a56cb928bc5792eb27.zip |
fetch: support hideRefs to speed up connectivity checks
With roughly 800 remotes all fetching into their own
refs/remotes/$REMOTE/* island, the connectivity check[1] gets
expensive for each fetch on systems which lack sufficient RAM to
cache objects.
To do a no-op fetch on one $REMOTE out of hundreds, hideRefs now
allows the no-op fetch to take ~30 seconds instead of ~20 minutes
on a noisy, RAM-constrained machine (localhost, so no network latency):
git -c fetch.hideRefs=refs \
-c fetch.hideRefs='!refs/remotes/$REMOTE/' \
fetch $REMOTE
[1] `git rev-list --objects --stdin --not --all --quiet --alternate-refs'
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r-- | builtin/fetch.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index a09606b472..edbeb19d3b 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1132,6 +1132,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, if (!connectivity_checked) { struct check_connected_options opt = CHECK_CONNECTED_INIT; + opt.exclude_hidden_refs_section = "fetch"; rm = ref_map; if (check_connected(iterate_ref_map, &rm, &opt)) { rc = error(_("%s did not send all necessary objects\n"), url); @@ -1325,6 +1326,7 @@ static int check_exist_and_connected(struct ref *ref_map) } opt.quiet = 1; + opt.exclude_hidden_refs_section = "fetch"; return check_connected(iterate_ref_map, &rm, &opt); } |