File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
657657
658658check_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+
660666test_done
You can’t perform that action at this time.
0 commit comments