mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-16 13:04:57 -05:00
Merge branch 'td/describe-tag-iteration' into jch
'git describe' has been taught to pass the 'refs/tags/' prefix down to the ref iterator when '--all' is not requested, avoiding unnecessary iteration over non-tag refs. * td/describe-tag-iteration: describe: limit default ref iteration to tags
This commit is contained in:
@@ -752,6 +752,9 @@ int cmd_describe(int argc,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!all)
|
||||
for_each_ref_opts.prefix = "refs/tags/";
|
||||
|
||||
hashmap_init(&names, commit_name_neq, NULL, 0);
|
||||
refs_for_each_ref_ext(get_main_ref_store(the_repository),
|
||||
get_name, NULL, &for_each_ref_opts);
|
||||
|
||||
@@ -27,4 +27,16 @@ test_perf 'describe HEAD with one tag' '
|
||||
git describe --match=new HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'set up many unrelated refs' '
|
||||
ref_count=10000 &&
|
||||
git tag -m tip tip HEAD &&
|
||||
test_seq -f "create refs/heads/describe-perf/%05d HEAD" $ref_count |
|
||||
git update-ref --stdin &&
|
||||
git pack-refs --all
|
||||
'
|
||||
|
||||
test_perf 'describe exact tag with many unrelated refs' '
|
||||
git describe --exact-match HEAD
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user