-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
name-rev: fix names by dropping taggerdate workaround #1468
Conversation
/submit |
Submitted as pull.1468.git.1674275336636.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
/submit |
Submitted as pull.1468.v2.git.1675751527365.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Calvin Wan wrote (reply to this): 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 |
User |
On the Git mailing list, Elijah Newren wrote (reply to this): 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. |
User |
Commit 7550424 ("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, aed06b9 -- was being named by name-rev as v4.6-rc1~9^2~792 which, while correct, was very suboptimal. Some investigation found that tweaking the MERGE_TRAVERSAL_WEIGHT to lower it could give alternate answers such as v3.13-rc7~9^2~14^2~42 or v3.13~5^2~4^2~2^2~1^2~42 A manual solution involving looking at tagger dates came up with v3.13-rc1~65^2^2~42 which is much nicer. That workaround was then implemented in name-rev. Unfortunately, the taggerdate heuristic is causing bugs. I was pointed to a case in a private repository where name-rev reports a name of the form v2022.10.02~86 when users expected to see one of the form v2022.10.01~2 (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 is causing problems. Further, it turns out that this taggerdate heuristic isn't even helping anymore. Due to the fix to naming logic in 3656f84 ("name-rev: prefer shorter names over following merges", 2021-12-04), we get improved names without the taggerdate heuristic. For the original commit of interest in linux.git, a modern git without the taggerdate heuristic still provides the same optimal answer of interest, namely: v3.13-rc1~65^2^2~42 So, the taggerdate is no longer providing benefit, and it is causing problems. Simply get rid of it. However, note that "taggerdate" as a variable is used to store things besides a taggerdate these days. Ever since commit ef1e740 ("name-rev: favor describing with tags and use committer date to tiebreak", 2017-03-29), this has been used to store committer dates and there it is used as a fallback tiebreaker (as opposed to a primary criteria overriding effective distance calculations). We do not want to remove that fallback tiebreaker, so not all instances of "taggerdate" are removed in this change. Signed-off-by: Elijah Newren <newren@gmail.com>
This branch is now known as |
This patch series was integrated into seen via git@19fa6cc. |
This patch series was integrated into seen via git@2547678. |
/submit |
Submitted as pull.1468.v3.git.1675933906906.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Junio C Hamano wrote (reply to this): "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> - /*
> - * When comparing names based on tags, prefer names
> - * based on the older tag, even if it is farther away.
> - */
> + /* If both are tags, we prefer the nearer one. */
> if (from_tag && name->from_tag)
> - return (name->taggerdate > taggerdate ||
> - (name->taggerdate == taggerdate &&
> - name_distance > new_distance));
> + return name_distance > new_distance;
OK.
> - /*
> - * We know that at least one of them is a non-tag at this point.
> - * favor a tag over a non-tag.
> - */
> + /* Favor a tag over a non-tag. */
> if (name->from_tag != from_tag)
> return from_tag;
The removed sentence is not something whose validity has changed due
to the code change. We still know at this point one of from_tag or
name->from_tag is false, thanks to the previous check, whose
condition did not change (only what is returned when the condition
holds changed). But it may be obvious to readers, so, ... OK. |
This patch series was integrated into seen via git@5a21d4f. |
This patch series was integrated into seen via git@09f61f8. |
There was a status update in the "New Topics" section about the branch "git name-rev" heuristics update. Will merge to 'next'. source: <pull.1468.v3.git.1675933906906.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@2c58a9a. |
This patch series was integrated into next via git@059bc95. |
This patch series was integrated into seen via git@0198d16. |
This patch series was integrated into seen via git@c750225. |
There was a status update in the "Cooking" section about the branch "git name-rev" heuristics update. Will merge to 'master'. source: <pull.1468.v3.git.1675933906906.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@a1ddf24. |
This patch series was integrated into seen via git@d5e62b8. |
This patch series was integrated into seen via git@d0cb923. |
This patch series was integrated into seen via git@10f1cf8. |
This patch series was integrated into seen via git@5fc6d00. |
This patch series was integrated into master via git@5fc6d00. |
This patch series was integrated into next via git@5fc6d00. |
Closed via 5fc6d00. |
Changes since v2: Fixed nearby comments based on code changes
Changes since v1: Slight tweaks to the commit message
cc: Calvin Wan calvinwan@google.com
cc: Elijah Newren newren@gmail.com