Message ID | pull.1468.v2.git.1675751527365.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] name-rev: fix names by dropping taggerdate workaround | expand |
Are there any cases where a taggerdate heuristic would be useful now? I'm having a hard time coming up with an example of such, so this change looks very reasonable to me. Even if there existed such a case, I would imagine it would be better solved using other heuristics rather than checking the taggerdate since that was a very loose heuristic to begin with. > 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; Comment above this block should be updated to match the new logic. -Calvin
On Tue, Feb 7, 2023 at 11:34 AM Calvin Wan <calvinwan@google.com> wrote: > > Are there any cases where a taggerdate heuristic would be useful now? > I'm having a hard time coming up with an example of such, so this > change looks very reasonable to me. Even if there existed such a case, > I would imagine it would be better solved using other heuristics rather > than checking the taggerdate since that was a very loose heuristic to > begin with. I'm currently only aware of cases where the heuristic hurts and none where it helps. I know it historically helped, but that was just a workaround to the algorithm being suboptimal. Since the algorithm has been fixed, I think the workaround can be shelved. > > 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; > > Comment above this block should be updated to match the new logic. Good catch; will fix.
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/t6120-describe.sh b/t/t6120-describe.sh index 9a35e783a75..c9afcef2018 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -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 + test_done