Skip to content

Commit 5fc6d00

Browse files
committed
Merge branch 'en/name-rev-make-taggerdate-much-less-important'
"git name-rev" heuristics update. * en/name-rev-make-taggerdate-much-less-important: name-rev: fix names by dropping taggerdate workaround
2 parents d9d677b + b2182a8 commit 5fc6d00

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

builtin/name-rev.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,11 @@ static int is_better_name(struct rev_name *name,
108108
int name_distance = effective_distance(name->distance, name->generation);
109109
int new_distance = effective_distance(distance, generation);
110110

111-
/*
112-
* When comparing names based on tags, prefer names
113-
* based on the older tag, even if it is farther away.
114-
*/
111+
/* If both are tags, we prefer the nearer one. */
115112
if (from_tag && name->from_tag)
116-
return (name->taggerdate > taggerdate ||
117-
(name->taggerdate == taggerdate &&
118-
name_distance > new_distance));
113+
return name_distance > new_distance;
119114

120-
/*
121-
* We know that at least one of them is a non-tag at this point.
122-
* favor a tag over a non-tag.
123-
*/
115+
/* Favor a tag over a non-tag. */
124116
if (name->from_tag != from_tag)
125117
return from_tag;
126118

t/t6120-describe.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
657657

658658
check_describe -C disjoint2 "B-3-gHASH" HEAD
659659

660+
test_expect_success 'setup misleading taggerdates' '
661+
GIT_COMMITTER_DATE="2006-12-12 12:31" git tag -a -m "another tag" newer-tag-older-commit unique-file~1
662+
'
663+
664+
check_describe newer-tag-older-commit~1 --contains unique-file~2
665+
660666
test_done

0 commit comments

Comments
 (0)