list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] name-rev: stop including taggerdate in naming of commits
@ 2023-01-21  4:28 Elijah Newren via GitGitGadget
  0 siblings, 0 replies; only message in thread
From: Elijah Newren via GitGitGadget @ 2023-01-21  4:28 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren, Elijah Newren

From: Elijah Newren <>

Commit 7550424804 ("name-rev: include taggerdate in considering the best
name", 2016-04-22) introduced the idea of using taggerdate in the
criteria for selecting the best name.  At the time, a certain commit in
linux.git -- namely, aed06b9cfcab -- was being named by name-rev as
which, while correct, felt very suboptimal.  Some investigation found
that tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give
alternate answers such as
A manual solution involving looking at tagger dates came up with
which was then implemented in name-rev.

It turns out that this taggerdate heuristic isn't needed due to a
subsequent change to fix the naming logic in 3656f84278 ("name-rev:
prefer shorter names over following merges", 2021-12-04).  Simply
removing the taggerdate heuristic from the calculation nowadays
still causes us to get the optimal answer on that particular commit
of interest in linux.git, namely:

Further, the taggerdate heuristic is causing bugs of its own.  I was
pointed to a case in a private repository where name-rev reports a name
of the form
when users expected to see one of the form
(I've modified the names and numbers a bit from the real testcase.)  As
you can probably guess, v2022.10.01 was created after v2022.10.02 (by a
few hours), even though it pointed to an older commit.  While the
condition is unusual even in the repository in question, it is not the
only problematic set of tags in that repository.  The taggerdate logic
was a workaround that is no longer needed, and is now causing suboptimal
results in other cases.

As such, remove the taggerdate in the comparison.  However, note that
"taggerdate" is actually also used to store commit dates since
ef1e74065c ("name-rev: favor describing with tags and use committer date
to tiebreak", 2017-03-29), where it is used as a fallback tiebreaker
when distances are equal.  We do not want to remove that fallback
tiebreaker, we are only removing the use of actual taggerdates as a
primary criteria overridding effective distance calculations.

Signed-off-by: Elijah Newren <>
    name-rev: stop including taggerdate in naming of commits

Fetch-It-Via: git fetch pr-1468/newren/fix-name-rev-v1

 builtin/name-rev.c  | 4 +---
 t/ | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 15535e914a6..df50abcdeb9 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -113,9 +113,7 @@ static int is_better_name(struct rev_name *name,
 	 * based on the older tag, even if it is farther away.
 	if (from_tag && name->from_tag)
-		return (name->taggerdate > taggerdate ||
-			(name->taggerdate == taggerdate &&
-			 name_distance > new_distance));
+		return name_distance > new_distance;
 	 * We know that at least one of them is a non-tag at this point.
diff --git a/t/ b/t/
index 9a35e783a75..c9afcef2018 100755
--- a/t/
+++ b/t/
@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
 check_describe -C disjoint2 "B-3-gHASH" HEAD
+test_expect_success 'setup misleading taggerdates' '
+	GIT_COMMITTER_DATE="2006-12-12 12:31" git tag -a -m "another tag" newer-tag-older-commit unique-file~1
+check_describe newer-tag-older-commit~1 --contains unique-file~2

base-commit: 221222b278e713054e65cbbbcb2b1ac85483ea89

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-21  4:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21  4:28 [PATCH] name-rev: stop including taggerdate in naming of commits Elijah Newren via GitGitGadget

Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).