summaryrefslogtreecommitdiff
path: root/t/t0410-partial-clone.sh
diff options
context:
space:
mode:
authorBenno Evers <benno@bmevers.de>2020-02-26 17:48:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-26 20:14:12 (GMT)
commit30b1c7ad9d64695a65c23f922e6ffd2fd35660da (patch)
tree513f58dfd862fd8198ccf6fdccfffde83db897b2 /t/t0410-partial-clone.sh
parent2d2118b814c11f509e1aa76cb07110f7231668dc (diff)
downloadgit-30b1c7ad9d64695a65c23f922e6ffd2fd35660da.zip
git-30b1c7ad9d64695a65c23f922e6ffd2fd35660da.tar.gz
git-30b1c7ad9d64695a65c23f922e6ffd2fd35660da.tar.bz2
describe: don't abort too early when searching tags
When searching the commit graph for tag candidates, `git-describe` will stop as soon as there is only one active branch left and it already found an annotated tag as a candidate. This works well as long as all branches eventually connect back to a common root, but if the tags are found across branches with no common ancestor B o----. \ o-----o---o----x A it can happen that the search on one branch terminates prematurely because a tag was found on another, independent branch. This scenario isn't quite as obscure as it sounds, since cloning with a limited depth often introduces many independent "dead ends" into the commit graph. The help text of `git-describe` states pretty clearly that when describing a commit D, the number appended to the emitted tag X should correspond to the number of commits found by `git log X..D`. Thus, this commit modifies the stopping condition to only abort the search when only one branch is left to search *and* all current best candidates are descendants from that branch. For repositories with a single root, this condition is always true: When the search is reduced to a single active branch, the current commit must be an ancestor of *all* tag candidates. This means that in the common case, this change will have no negative performance impact since the same number of commits as before will be traversed. Signed-off-by: Benno Evers <benno@bmevers.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0410-partial-clone.sh')
0 files changed, 0 insertions, 0 deletions