{"thread":{"id":"59129","subject":"[PATCH] name-rev: stop including taggerdate in naming of commits","startedAt":"2023-01-21T04:30:23Z","lastAt":"2023-02-09T17:10:55Z","messageCount":6,"participants":["Elijah Newren via GitGitGadget","Calvin Wan","Elijah Newren","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"470833","messageId":"pull.1468.git.1674275336636.gitgitgadget@gmail.com","threadId":"59129","inReplyTo":null,"subject":"[PATCH] name-rev: stop including taggerdate in naming of commits","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-21T04:28:56Z","receivedAt":"2023-01-21T04:30:23Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nCommit 7550424804 (\"name-rev: include taggerdate in considering the best\nname\", 2016-04-22) introduced the idea of using taggerdate in the\ncriteria for selecting the best name.  At the time, a certain commit in\nlinux.git -- namely, aed06b9cfcab -- was being named by name-rev as\n    v4.6-rc1~9^2~792\nwhich, while correct, felt very suboptimal.  Some investigation found\nthat tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give\nalternate answers such as\n    v3.13-rc7~9^2~14^2~42\nor\n    v3.13~5^2~4^2~2^2~1^2~42\nA manual solution involving looking at tagger dates came up with\n    v3.13-rc1~65^2^2~42\nwhich was then implemented in name-rev.\n\nIt turns out that this taggerdate heuristic isn't needed due to a\nsubsequent change to fix the naming logic in 3656f84278 (\"name-rev:\nprefer shorter names over following merges\", 2021-12-04).  Simply\nremoving the taggerdate heuristic from the calculation nowadays\nstill causes us to get the optimal answer on that particular commit\nof interest in linux.git, namely:\n    v3.13-rc1~65^2^2~42\n\nFurther, the taggerdate heuristic is causing bugs of its own.  I was\npointed to a case in a private repository where name-rev reports a name\nof the form\n    v2022.10.02~86\nwhen users expected to see one of the form\n    v2022.10.01~2\n(I've modified the names and numbers a bit from the real testcase.)  As\nyou can probably guess, v2022.10.01 was created after v2022.10.02 (by a\nfew hours), even though it pointed to an older commit.  While the\ncondition is unusual even in the repository in question, it is not the\nonly problematic set of tags in that repository.  The taggerdate logic\nwas a workaround that is no longer needed, and is now causing suboptimal\nresults in other cases.\n\nAs such, remove the taggerdate in the comparison.  However, note that\n\"taggerdate\" is actually also used to store commit dates since\nef1e74065c (\"name-rev: favor describing with tags and use committer date\nto tiebreak\", 2017-03-29), where it is used as a fallback tiebreaker\nwhen distances are equal.  We do not want to remove that fallback\ntiebreaker, we are only removing the use of actual taggerdates as a\nprimary criteria overridding effective distance calculations.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n    name-rev: stop including taggerdate in naming of commits\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1468%2Fnewren%2Ffix-name-rev-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1468/newren/fix-name-rev-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1468\n\n builtin/name-rev.c  | 4 +---\n t/t6120-describe.sh | 6 ++++++\n 2 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 15535e914a6..df50abcdeb9 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -113,9 +113,7 @@ static int is_better_name(struct rev_name *name,\n \t * based on the older tag, even if it is farther away.\n \t */\n \tif (from_tag && name->from_tag)\n-\t\treturn (name->taggerdate > taggerdate ||\n-\t\t\t(name->taggerdate == taggerdate &&\n-\t\t\t name_distance > new_distance));\n+\t\treturn name_distance > new_distance;\n \n \t/*\n \t * We know that at least one of them is a non-tag at this point.\ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 9a35e783a75..c9afcef2018 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '\n \n check_describe -C disjoint2 \"B-3-gHASH\" HEAD\n \n+test_expect_success 'setup misleading taggerdates' '\n+\tGIT_COMMITTER_DATE=\"2006-12-12 12:31\" git tag -a -m \"another tag\" newer-tag-older-commit unique-file~1\n+'\n+\n+check_describe newer-tag-older-commit~1 --contains unique-file~2\n+\n test_done\n\nbase-commit: 221222b278e713054e65cbbbcb2b1ac85483ea89\n-- \ngitgitgadget\n"},{"id":"471669","messageId":"pull.1468.v2.git.1675751527365.gitgitgadget@gmail.com","threadId":"59129","inReplyTo":"pull.1468.git.1674275336636.gitgitgadget@gmail.com","subject":"[PATCH v2] name-rev: fix names by dropping taggerdate workaround","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-02-07T06:32:07Z","receivedAt":"2023-02-07T06:32:14Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nCommit 7550424804 (\"name-rev: include taggerdate in considering the best\nname\", 2016-04-22) introduced the idea of using taggerdate in the\ncriteria for selecting the best name.  At the time, a certain commit in\nlinux.git -- namely, aed06b9cfcab -- was being named by name-rev as\n    v4.6-rc1~9^2~792\nwhich, while correct, was very suboptimal.  Some investigation found\nthat tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give\nalternate answers such as\n    v3.13-rc7~9^2~14^2~42\nor\n    v3.13~5^2~4^2~2^2~1^2~42\nA manual solution involving looking at tagger dates came up with\n    v3.13-rc1~65^2^2~42\nwhich is much nicer.  That workaround was then implemented in name-rev.\n\nUnfortunately, the taggerdate heuristic is causing bugs.  I was pointed\nto a case in a private repository where name-rev reports a name of the\nform\n    v2022.10.02~86\nwhen users expected to see one of the form\n    v2022.10.01~2\n(I've modified the names and numbers a bit from the real testcase.)  As\nyou can probably guess, v2022.10.01 was created after v2022.10.02 (by a\nfew hours), even though it pointed to an older commit.  While the\ncondition is unusual even in the repository in question, it is not the\nonly problematic set of tags in that repository.  The taggerdate logic\nis causing problems.\n\nFurther, it turns out that this taggerdate heuristic isn't even helping\nanymore.  Due to the fix to naming logic in 3656f84278 (\"name-rev:\nprefer shorter names over following merges\", 2021-12-04), we get\nimproved names without the taggerdate heuristic.  For the original\ncommit of interest in linux.git, a modern git without the taggerdate\nheuristic still provides the same optimal answer of interest, namely:\n    v3.13-rc1~65^2^2~42\n\nSo, the taggerdate is no longer providing benefit, and it is causing\nproblems.  Simply get rid of it.\n\nHowever, note that \"taggerdate\" as a variable is used to store things\nbesides a taggerdate these days.  Ever since commit ef1e74065c\n(\"name-rev: favor describing with tags and use committer date to\ntiebreak\", 2017-03-29), this has been used to store committer dates and\nthere it is used as a fallback tiebreaker (as opposed to a primary\ncriteria overriding effective distance calculations).  We do not want to\nremove that fallback tiebreaker, so not all instances of \"taggerdate\"\nare removed in this change.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n    name-rev: fix names by dropping taggerdate workaround\n    \n    Changes since v1: Slight tweaks to the commit message\n    \n    v1 was never picked up or commented on, so this is mostly just a\n    resubmission, with a rewording to make it clear this is a bugfix.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1468%2Fnewren%2Ffix-name-rev-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1468/newren/fix-name-rev-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1468\n\nRange-diff vs v1:\n\n 1:  78bbfb3286b ! 1:  206726fc954 name-rev: stop including taggerdate in naming of commits\n     @@ Metadata\n      Author: Elijah Newren <newren@gmail.com>\n      \n       ## Commit message ##\n     -    name-rev: stop including taggerdate in naming of commits\n     +    name-rev: fix names by dropping taggerdate workaround\n      \n          Commit 7550424804 (\"name-rev: include taggerdate in considering the best\n          name\", 2016-04-22) introduced the idea of using taggerdate in the\n          criteria for selecting the best name.  At the time, a certain commit in\n          linux.git -- namely, aed06b9cfcab -- was being named by name-rev as\n              v4.6-rc1~9^2~792\n     -    which, while correct, felt very suboptimal.  Some investigation found\n     +    which, while correct, was very suboptimal.  Some investigation found\n          that tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give\n          alternate answers such as\n              v3.13-rc7~9^2~14^2~42\n     @@ Commit message\n              v3.13~5^2~4^2~2^2~1^2~42\n          A manual solution involving looking at tagger dates came up with\n              v3.13-rc1~65^2^2~42\n     -    which was then implemented in name-rev.\n     +    which is much nicer.  That workaround was then implemented in name-rev.\n      \n     -    It turns out that this taggerdate heuristic isn't needed due to a\n     -    subsequent change to fix the naming logic in 3656f84278 (\"name-rev:\n     -    prefer shorter names over following merges\", 2021-12-04).  Simply\n     -    removing the taggerdate heuristic from the calculation nowadays\n     -    still causes us to get the optimal answer on that particular commit\n     -    of interest in linux.git, namely:\n     -        v3.13-rc1~65^2^2~42\n     -\n     -    Further, the taggerdate heuristic is causing bugs of its own.  I was\n     -    pointed to a case in a private repository where name-rev reports a name\n     -    of the form\n     +    Unfortunately, the taggerdate heuristic is causing bugs.  I was pointed\n     +    to a case in a private repository where name-rev reports a name of the\n     +    form\n              v2022.10.02~86\n          when users expected to see one of the form\n              v2022.10.01~2\n     @@ Commit message\n          few hours), even though it pointed to an older commit.  While the\n          condition is unusual even in the repository in question, it is not the\n          only problematic set of tags in that repository.  The taggerdate logic\n     -    was a workaround that is no longer needed, and is now causing suboptimal\n     -    results in other cases.\n     +    is causing problems.\n     +\n     +    Further, it turns out that this taggerdate heuristic isn't even helping\n     +    anymore.  Due to the fix to naming logic in 3656f84278 (\"name-rev:\n     +    prefer shorter names over following merges\", 2021-12-04), we get\n     +    improved names without the taggerdate heuristic.  For the original\n     +    commit of interest in linux.git, a modern git without the taggerdate\n     +    heuristic still provides the same optimal answer of interest, namely:\n     +        v3.13-rc1~65^2^2~42\n     +\n     +    So, the taggerdate is no longer providing benefit, and it is causing\n     +    problems.  Simply get rid of it.\n      \n     -    As such, remove the taggerdate in the comparison.  However, note that\n     -    \"taggerdate\" is actually also used to store commit dates since\n     -    ef1e74065c (\"name-rev: favor describing with tags and use committer date\n     -    to tiebreak\", 2017-03-29), where it is used as a fallback tiebreaker\n     -    when distances are equal.  We do not want to remove that fallback\n     -    tiebreaker, we are only removing the use of actual taggerdates as a\n     -    primary criteria overridding effective distance calculations.\n     +    However, note that \"taggerdate\" as a variable is used to store things\n     +    besides a taggerdate these days.  Ever since commit ef1e74065c\n     +    (\"name-rev: favor describing with tags and use committer date to\n     +    tiebreak\", 2017-03-29), this has been used to store committer dates and\n     +    there it is used as a fallback tiebreaker (as opposed to a primary\n     +    criteria overriding effective distance calculations).  We do not want to\n     +    remove that fallback tiebreaker, so not all instances of \"taggerdate\"\n     +    are removed in this change.\n      \n          Signed-off-by: Elijah Newren <newren@gmail.com>\n      \n\n\n builtin/name-rev.c  | 4 +---\n t/t6120-describe.sh | 6 ++++++\n 2 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 15535e914a6..df50abcdeb9 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -113,9 +113,7 @@ static int is_better_name(struct rev_name *name,\n \t * based on the older tag, even if it is farther away.\n \t */\n \tif (from_tag && name->from_tag)\n-\t\treturn (name->taggerdate > taggerdate ||\n-\t\t\t(name->taggerdate == taggerdate &&\n-\t\t\t name_distance > new_distance));\n+\t\treturn name_distance > new_distance;\n \n \t/*\n \t * We know that at least one of them is a non-tag at this point.\ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 9a35e783a75..c9afcef2018 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '\n \n check_describe -C disjoint2 \"B-3-gHASH\" HEAD\n \n+test_expect_success 'setup misleading taggerdates' '\n+\tGIT_COMMITTER_DATE=\"2006-12-12 12:31\" git tag -a -m \"another tag\" newer-tag-older-commit unique-file~1\n+'\n+\n+check_describe newer-tag-older-commit~1 --contains unique-file~2\n+\n test_done\n\nbase-commit: 221222b278e713054e65cbbbcb2b1ac85483ea89\n-- \ngitgitgadget\n"},{"id":"471717","messageId":"20230207193407.394971-1-calvinwan@google.com","threadId":"59129","inReplyTo":"pull.1468.v2.git.1675751527365.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] name-rev: fix names by dropping taggerdate workaround","fromName":"Calvin Wan","fromEmail":"calvinwan@google.com","sentAt":"2023-02-07T19:34:07Z","receivedAt":"2023-02-07T19:34:20Z","isPatch":true,"sender":{"key":"calvinwan@google.com","avatar":"https://avatars.githubusercontent.com/u/92547554?v=4"},"body":"Are there any cases where a taggerdate heuristic would be useful now?\nI'm having a hard time coming up with an example of such, so this\nchange looks very reasonable to me. Even if there existed such a case,\nI would imagine it would be better solved using other heuristics rather\nthan checking the taggerdate since that was a very loose heuristic to\nbegin with.\n\n> diff --git a/builtin/name-rev.c b/builtin/name-rev.c\n> index 15535e914a6..df50abcdeb9 100644\n> --- a/builtin/name-rev.c\n> +++ b/builtin/name-rev.c\n> @@ -113,9 +113,7 @@ static int is_better_name(struct rev_name *name,\n>  \t * based on the older tag, even if it is farther away.\n>  \t */\n>  \tif (from_tag && name->from_tag)\n> -\t\treturn (name->taggerdate > taggerdate ||\n> -\t\t\t(name->taggerdate == taggerdate &&\n> -\t\t\t name_distance > new_distance));\n> +\t\treturn name_distance > new_distance;\n\nComment above this block should be updated to match the new logic.\n\n-Calvin\n"},{"id":"471750","messageId":"CABPp-BHbqQtws3cg4-udC4XixeFk+BTp43xA48G-ok9tfcZcVg@mail.gmail.com","threadId":"59129","inReplyTo":"20230207193407.394971-1-calvinwan@google.com","subject":"Re: [PATCH v2] name-rev: fix names by dropping taggerdate workaround","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-02-08T03:33:45Z","receivedAt":"2023-02-08T03:34:03Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Feb 7, 2023 at 11:34 AM Calvin Wan <calvinwan@google.com> wrote:\n>\n> Are there any cases where a taggerdate heuristic would be useful now?\n> I'm having a hard time coming up with an example of such, so this\n> change looks very reasonable to me. Even if there existed such a case,\n> I would imagine it would be better solved using other heuristics rather\n> than checking the taggerdate since that was a very loose heuristic to\n> begin with.\n\nI'm currently only aware of cases where the heuristic hurts and none\nwhere it helps.  I know it historically helped, but that was just a\nworkaround to the algorithm being suboptimal.  Since the algorithm has\nbeen fixed, I think the workaround can be shelved.\n\n> > diff --git a/builtin/name-rev.c b/builtin/name-rev.c\n> > index 15535e914a6..df50abcdeb9 100644\n> > --- a/builtin/name-rev.c\n> > +++ b/builtin/name-rev.c\n> > @@ -113,9 +113,7 @@ static int is_better_name(struct rev_name *name,\n> >        * based on the older tag, even if it is farther away.\n> >        */\n> >       if (from_tag && name->from_tag)\n> > -             return (name->taggerdate > taggerdate ||\n> > -                     (name->taggerdate == taggerdate &&\n> > -                      name_distance > new_distance));\n> > +             return name_distance > new_distance;\n>\n> Comment above this block should be updated to match the new logic.\n\nGood catch; will fix.\n"},{"id":"471842","messageId":"pull.1468.v3.git.1675933906906.gitgitgadget@gmail.com","threadId":"59129","inReplyTo":"pull.1468.v2.git.1675751527365.gitgitgadget@gmail.com","subject":"[PATCH v3] name-rev: fix names by dropping taggerdate workaround","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-02-09T09:11:46Z","receivedAt":"2023-02-09T09:12:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nCommit 7550424804 (\"name-rev: include taggerdate in considering the best\nname\", 2016-04-22) introduced the idea of using taggerdate in the\ncriteria for selecting the best name.  At the time, a certain commit in\nlinux.git -- namely, aed06b9cfcab -- was being named by name-rev as\n    v4.6-rc1~9^2~792\nwhich, while correct, was very suboptimal.  Some investigation found\nthat tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give\nalternate answers such as\n    v3.13-rc7~9^2~14^2~42\nor\n    v3.13~5^2~4^2~2^2~1^2~42\nA manual solution involving looking at tagger dates came up with\n    v3.13-rc1~65^2^2~42\nwhich is much nicer.  That workaround was then implemented in name-rev.\n\nUnfortunately, the taggerdate heuristic is causing bugs.  I was pointed\nto a case in a private repository where name-rev reports a name of the\nform\n    v2022.10.02~86\nwhen users expected to see one of the form\n    v2022.10.01~2\n(I've modified the names and numbers a bit from the real testcase.)  As\nyou can probably guess, v2022.10.01 was created after v2022.10.02 (by a\nfew hours), even though it pointed to an older commit.  While the\ncondition is unusual even in the repository in question, it is not the\nonly problematic set of tags in that repository.  The taggerdate logic\nis causing problems.\n\nFurther, it turns out that this taggerdate heuristic isn't even helping\nanymore.  Due to the fix to naming logic in 3656f84278 (\"name-rev:\nprefer shorter names over following merges\", 2021-12-04), we get\nimproved names without the taggerdate heuristic.  For the original\ncommit of interest in linux.git, a modern git without the taggerdate\nheuristic still provides the same optimal answer of interest, namely:\n    v3.13-rc1~65^2^2~42\n\nSo, the taggerdate is no longer providing benefit, and it is causing\nproblems.  Simply get rid of it.\n\nHowever, note that \"taggerdate\" as a variable is used to store things\nbesides a taggerdate these days.  Ever since commit ef1e74065c\n(\"name-rev: favor describing with tags and use committer date to\ntiebreak\", 2017-03-29), this has been used to store committer dates and\nthere it is used as a fallback tiebreaker (as opposed to a primary\ncriteria overriding effective distance calculations).  We do not want to\nremove that fallback tiebreaker, so not all instances of \"taggerdate\"\nare removed in this change.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n    name-rev: fix names by dropping taggerdate workaround\n    \n    Changes since v2: Fixed nearby comments based on code changes\n    \n    Changes since v1: Slight tweaks to the commit message\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1468%2Fnewren%2Ffix-name-rev-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1468/newren/fix-name-rev-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/1468\n\nRange-diff vs v2:\n\n 1:  206726fc954 ! 1:  ff57b1583b1 name-rev: fix names by dropping taggerdate workaround\n     @@ Commit message\n      \n       ## builtin/name-rev.c ##\n      @@ builtin/name-rev.c: static int is_better_name(struct rev_name *name,\n     - \t * based on the older tag, even if it is farther away.\n     - \t */\n     + \tint name_distance = effective_distance(name->distance, name->generation);\n     + \tint new_distance = effective_distance(distance, generation);\n     + \n     +-\t/*\n     +-\t * When comparing names based on tags, prefer names\n     +-\t * based on the older tag, even if it is farther away.\n     +-\t */\n     ++\t/* If both are tags, we prefer the nearer one. */\n       \tif (from_tag && name->from_tag)\n      -\t\treturn (name->taggerdate > taggerdate ||\n      -\t\t\t(name->taggerdate == taggerdate &&\n      -\t\t\t name_distance > new_distance));\n      +\t\treturn name_distance > new_distance;\n       \n     - \t/*\n     - \t * We know that at least one of them is a non-tag at this point.\n     +-\t/*\n     +-\t * We know that at least one of them is a non-tag at this point.\n     +-\t * favor a tag over a non-tag.\n     +-\t */\n     ++\t/* Favor a tag over a non-tag. */\n     + \tif (name->from_tag != from_tag)\n     + \t\treturn from_tag;\n     + \n      \n       ## t/t6120-describe.sh ##\n      @@ t/t6120-describe.sh: test_expect_success 'setup: describe commits with disjoint bases 2' '\n\n\n builtin/name-rev.c  | 14 +++-----------\n t/t6120-describe.sh |  6 ++++++\n 2 files changed, 9 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 15535e914a6..0ebf06fad5a 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -108,19 +108,11 @@ static int is_better_name(struct rev_name *name,\n \tint name_distance = effective_distance(name->distance, name->generation);\n \tint new_distance = effective_distance(distance, generation);\n \n-\t/*\n-\t * When comparing names based on tags, prefer names\n-\t * based on the older tag, even if it is farther away.\n-\t */\n+\t/* If both are tags, we prefer the nearer one. */\n \tif (from_tag && name->from_tag)\n-\t\treturn (name->taggerdate > taggerdate ||\n-\t\t\t(name->taggerdate == taggerdate &&\n-\t\t\t name_distance > new_distance));\n+\t\treturn name_distance > new_distance;\n \n-\t/*\n-\t * We know that at least one of them is a non-tag at this point.\n-\t * favor a tag over a non-tag.\n-\t */\n+\t/* Favor a tag over a non-tag. */\n \tif (name->from_tag != from_tag)\n \t\treturn from_tag;\n \ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 9a35e783a75..c9afcef2018 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '\n \n check_describe -C disjoint2 \"B-3-gHASH\" HEAD\n \n+test_expect_success 'setup misleading taggerdates' '\n+\tGIT_COMMITTER_DATE=\"2006-12-12 12:31\" git tag -a -m \"another tag\" newer-tag-older-commit unique-file~1\n+'\n+\n+check_describe newer-tag-older-commit~1 --contains unique-file~2\n+\n test_done\n\nbase-commit: 221222b278e713054e65cbbbcb2b1ac85483ea89\n-- \ngitgitgadget\n"},{"id":"471871","messageId":"xmqqilgaojci.fsf@gitster.g","threadId":"59129","inReplyTo":"pull.1468.v3.git.1675933906906.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] name-rev: fix names by dropping taggerdate workaround","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-02-09T17:10:37Z","receivedAt":"2023-02-09T17:10:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> -\t/*\n> -\t * When comparing names based on tags, prefer names\n> -\t * based on the older tag, even if it is farther away.\n> -\t */\n> +\t/* If both are tags, we prefer the nearer one. */\n>  \tif (from_tag && name->from_tag)\n> -\t\treturn (name->taggerdate > taggerdate ||\n> -\t\t\t(name->taggerdate == taggerdate &&\n> -\t\t\t name_distance > new_distance));\n> +\t\treturn name_distance > new_distance;\n\nOK.\n\n> -\t/*\n> -\t * We know that at least one of them is a non-tag at this point.\n> -\t * favor a tag over a non-tag.\n> -\t */\n> +\t/* Favor a tag over a non-tag. */\n>  \tif (name->from_tag != from_tag)\n>  \t\treturn from_tag;\n\nThe removed sentence is not something whose validity has changed due\nto the code change.  We still know at this point one of from_tag or\nname->from_tag is false, thanks to the previous check, whose\ncondition did not change (only what is returned when the condition\nholds changed).  But it may be obvious to readers, so, ... OK.\n"}]}