diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-02-06 01:40:45 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-06 01:40:45 +0100 |
commit | 6254fa13596cee0ea645317ba3eb4552430f38b4 (patch) | |
tree | 478d0213d0acbaed6cec84a10a92670520b736bd /ls-refs.c | |
parent | Merge branch 'zh/ls-files-deduplicate' (diff) | |
parent | ls-refs.c: traverse prefixes of disjoint "ref-prefix" sets (diff) | |
download | git-6254fa13596cee0ea645317ba3eb4552430f38b4.tar.xz git-6254fa13596cee0ea645317ba3eb4552430f38b4.zip |
Merge branch 'tb/ls-refs-optim'
The ls-refs protocol operation has been optimized to narrow the
sub-hierarchy of refs/ it walks to produce response.
* tb/ls-refs-optim:
ls-refs.c: traverse prefixes of disjoint "ref-prefix" sets
ls-refs.c: initialize 'prefixes' before using it
refs: expose 'for_each_fullref_in_prefixes'
Diffstat (limited to 'ls-refs.c')
-rw-r--r-- | ls-refs.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -90,6 +90,7 @@ int ls_refs(struct repository *r, struct strvec *keys, struct ls_refs_data data; memset(&data, 0, sizeof(data)); + strvec_init(&data.prefixes); git_config(ls_refs_config, NULL); @@ -109,7 +110,10 @@ int ls_refs(struct repository *r, struct strvec *keys, die(_("expected flush after ls-refs arguments")); head_ref_namespaced(send_ref, &data); - for_each_namespaced_ref(send_ref, &data); + if (!data.prefixes.nr) + strvec_push(&data.prefixes, ""); + for_each_fullref_in_prefixes(get_git_namespace(), data.prefixes.v, + send_ref, &data, 0); packet_flush(1); strvec_clear(&data.prefixes); return 0; |