]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/name-rev.c
name-rev: refactor logic to see if a new candidate is a better name
authorJunio C Hamano <gitster@pobox.com>
Wed, 29 Mar 2017 14:39:15 +0000 (16:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Mar 2017 17:53:30 +0000 (10:53 -0700)
commit0041bf6544b9b46022b6362eae834a36505d7baa
treed6a89a7da27a0ffd8a84006c1b81322e9ea79128
parent7d5a38b61fad51b765117ae6dae9117db74dac3d
name-rev: refactor logic to see if a new candidate is a better name

When we encounter a new ref that could describe the commit we are
looking at, we compare the name that is formed using that ref and
the name we found so far and pick a better one.

Factor the comparison logic out to a separate helper function, while
keeping the current logic the same (i.e. a name that is based on an
older tag is better, and if two tags of the same age can reach the
commit, the one with fewer number of hops to reach the commit is
better).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/name-rev.c