Skip to content
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

tools: add .git-blame-ignore-revs file #43017

Closed
wants to merge 2 commits into from

Conversation

RaisinTen
Copy link
Contributor

@RaisinTen RaisinTen commented May 9, 2022

This would make the GitHub blame UI ignore the revisions mentioned in
the .git-blame-ignore-revs file. For now, it ignores the change
introduced in 6afd3fc as asked for in #42752 (comment).

This would make the GitHub blame UI ignore the revisions mentioned in
the .git-blame-ignore-revs file. For now, it ignores the changes
introduced in:

Refs: https://github.blog/changelog/2022-03-24-ignore-commits-in-the-blame-view-beta
Signed-off-by: Darshan Sen raisinten@gmail.com

cc @targos

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label May 9, 2022
@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 9, 2022
@targos
Copy link
Member

targos commented May 9, 2022

Changes to this file would need to be adapted to work on release branches. I don't know how we should handle this.

@RaisinTen
Copy link
Contributor Author

Maybe we shouldn't backport this change to the release branches? Electron didn't backport the change that added this file - electron/electron#33171.

@RaisinTen RaisinTen added the dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. label May 9, 2022
@targos
Copy link
Member

targos commented May 9, 2022

Maybe we shouldn't backport this change to the release branches? Electron didn't backport the change that added this file - electron/electron#33171.

I'm fine with that. We should probably add a rule to label-pr-config.yml so we don't forget to add the label.

@RaisinTen
Copy link
Contributor Author

RaisinTen commented May 9, 2022

Done, mapped it to a https://github.com/nodejs/node/labels/dont-backport label.

@targos
Copy link
Member

targos commented May 9, 2022

Done, mapped it to a dont-backport label.

Is it a special placeholder for all dont-land-on-* labels?

@RaisinTen
Copy link
Contributor Author

Yes, that's the intention.

@RaisinTen RaisinTen added dont-backport and removed dont-land-on-v14.x dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. labels May 9, 2022
@targos
Copy link
Member

targos commented May 9, 2022

Okay, that seems useful but some things will have to be adapted for it.
I found:

@mscdex
Copy link
Contributor

mscdex commented May 9, 2022

Why are we using this feature?

@richardlau
Copy link
Member

richardlau commented May 9, 2022

Done, mapped it to a dont-backport PRs that should not be backported to any release line. label.

Can we keep the individual dont-land-on-* labels? dont-backport is going to introduce ambiguity.

@RaisinTen
Copy link
Contributor Author

@mscdex

Why are we using this feature?

From https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view:

This can be useful when a few commits make extensive changes to your code.

@RaisinTen
Copy link
Contributor Author

RaisinTen commented May 10, 2022

@richardlau

Can we keep the individual dont-land-on-* labels? dont-backport is going to introduce ambiguity.

Yes, we could do that but that would leave us with 2 options:

  1. apply all the dont-land-on-* labels manually whenever we make changes to this file OR
  2. we could map this file to all the currently present dont-land-on-* labels in .github/label-pr-config.yml, so that the bot applies those automatically whenever a change touches this file but the downside is that it would require us to update the label list whenever there is a new major branch or if a branch goes EOL

I'll delete the dont-backport label and stick to option 1 if there are no objections by the EOD. (Done)

@RaisinTen RaisinTen removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 10, 2022
Copy link
Contributor

@mscdex mscdex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be useful when a few commits make extensive changes to your code.

I get that, but in general it seems impossible to know if someone will want to find the changes in any particular commit (big or small), so ignoring commits isn't very helpful.

@RaisinTen
Copy link
Contributor Author

@mscdex

I get that, but in general it seems impossible to know if someone will want to find the changes in any particular commit (big or small), so ignoring commits isn't very helpful.

In its current state, the PR is not about adding a general definition for all kinds of commits we want to include in this file. It's just about including 6afd3fc as asked for in #42752 (comment). The comment has some upvotes and no objections, so I took that as a clear indication of - yes, this looks like a good idea! That's why, I think it would be good if we add this commit to the list unless we have a concrete answer to this question - Why would someone want to find a change in 6afd3fc?

@mscdex
Copy link
Contributor

mscdex commented May 18, 2022

@mscdex do you still feel -1 about ignoring this commit?

Considering my comments have all been about the feature being used here and not any specific commits, technically yes.

@BethGriggs
Copy link
Member

Maybe we shouldn't backport this change to the release branches? Electron didn't backport the change that added this file - electron/electron#33171.

I'm not sure if this has already been considered - but this file will end up on future release branches (v19.x-staging onwards). That may not be a problem at all. But I figured I should mention because we will be in a state where this file exists on some release branches and not others.

@targos
Copy link
Member

targos commented May 19, 2022

@BethGriggs I think it's fine for the file to end up in release branches.
We can also decide to let it be backported automatically to remove releaser burden, just knowing that some commit hashes might not exist in the branches (it probably won't break GitHub).

Copy link
Contributor

@LiviaMedeiros LiviaMedeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would landing this alone give a greenish light to huge code churns (for example, enforcing non-controversal lint rules)?

.git-blame-ignore-revs Outdated Show resolved Hide resolved
@RaisinTen
Copy link
Contributor Author

Would landing this alone give a greenish light to huge code churns (for example, enforcing non-controversal lint rules)?

I believe so, yes!

Co-authored-by: Livia Medeiros <74449973+LiviaMedeiros@users.noreply.github.com>
@RaisinTen RaisinTen added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label May 22, 2022
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally feel like this does not really benefit us. We have to go through lots of blame steps anyway. I would rather not skip anything in case it has indeed been added. I would for example compare changes between two revisions and if there's a change in-between that I did not notice, it'll definitely be confusing.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maintaining this file will be too much of work to be useful.

@RaisinTen
Copy link
Contributor Author

I think maintaining this file will be too much of work to be useful.

@mcollina how is this a maintenance burden? No one is obliged to update this file, it's more of an opt-in thing - if someone wants a commit to be ignored from the blame UI, they could add the commit info to this file. Not updating this file will not cause any issues.

@BethGriggs
Copy link
Member

I'm somewhat -0 on this. I sometimes use the blame UI when comparing across release branches. Not that this PR should be blocked because of one person's workflow - I just think there's a non-zero chance of it introducing confusion by hiding the piece of blame history that someone is actively looking for.

@mcollina
Copy link
Member

mcollina commented Jun 1, 2022

I think maintaining this file will be too much of work to be useful.

@mcollina how is this a maintenance burden? No one is obliged to update this file, it's more of an opt-in thing - if someone wants a commit to be ignored from the blame UI, they could add the commit info to this file. Not updating this file will not cause any issues.

I'm not seeing the reasoning behind doing so.
Landing PRs is hard enough already, doing this change to add a commit that will not work across multiple release lines it does not look appealing.

@RaisinTen
Copy link
Contributor Author

I'm somewhat -0 on this. I sometimes use the blame UI when comparing across release branches. Not that this PR should be blocked because of one person's workflow - I just think there's a non-zero chance of it introducing confusion by hiding the piece of blame history that someone is actively looking for.

@BethGriggs when a commit gets backported to a release branch, doesn't it get a SHA that's different from the SHA in the HEAD branch, i.e., the one tracked in this file? If the SHA is different, this file won't hide it from the blame UI.

@RaisinTen
Copy link
Contributor Author

I'm not seeing the reasoning behind doing so.

@mcollina it's because such commits pollute the GitHub blame output, see #41768 (comment).

Landing PRs is hard enough already

Why would landing a change to this file be hard? It won't even require a Jenkins CI run because it doesn't affect the node binary.

@BethGriggs
Copy link
Member

@BethGriggs when a commit gets backported to a release branch, doesn't it get a SHA that's different from the SHA in the HEAD branch, i.e., the one tracked in this file? If the SHA is different, this file won't hide it from the blame UI.

I think the answer is both yes and no 😅 . For new majors, we mirror master up until the vN.0.0 release commit. So the SHAs could match those on master in some release branches. I think it would depend on where the specific commit is in history - but I do believe this means it's possible it could match in some release branches and not others.

I don't want to derail with obscure (likely rare?) cases, just to share my non-blocking concerns that this might get confusing.

@mcollina mcollina dismissed their stale review June 6, 2022 09:27

Moving my concerns to a soft -0. I'm not approving this but if others feels strongly about it, do it.

@tniessen
Copy link
Member

Would landing this alone give a greenish light to huge code churns (for example, enforcing non-controversal lint rules)?

I'm not so sure; messing up git blame is just one downside of large diffs. For example, huge diffs usually cause other open PRs or local branches to get stuck on merge conflicts.

@RaisinTen
Copy link
Contributor Author

Would landing this alone give a greenish light to huge code churns (for example, enforcing non-controversal lint rules)?

I'm not so sure; messing up git blame is just one downside of large diffs. For example, huge diffs usually cause other open PRs or local branches to get stuck on merge conflicts.

I guess running into merge conflicts is a fate of PRs that stay open long enough. However, if the diff in question was introduced by a change that enforces a lint rule, it could be resolved by first accepting the changes already present in the PR branch during the rebase (git rebase -X theirs main) and then committing the changes introduced by the formatter.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 27, 2022

I'm -1 on this for all of the reasons previously mentioned. I also won't block this, but I think you should consider the number of people who have raised concerns here, as well as the explicit request for changes.

@jasnell
Copy link
Member

jasnell commented Jun 27, 2022

Really not a fan of this.

@LiviaMedeiros
Copy link
Contributor

LiviaMedeiros commented Jun 27, 2022

Would landing this alone give a greenish light to huge code churns (for example, enforcing non-controversal lint rules)?

I'm not so sure; messing up git blame is just one downside of large diffs. For example, huge diffs usually cause other open PRs or local branches to get stuck on merge conflicts.

Summarizing downsides of large diffs:

  1. It pollutes git blame across whole codebase.
  2. It causes merge conflicts on branches basing on commits before churn.
  3. It pollutes diffs between release lines.

I'm seeing (1) as a huge problem that might be effectively solved by this file.
(2) and (3) are huge as well, but their significance is temporal.

On the other side we have accepted-but-not-enforced linter rules such as trailing commas and sorted keys. It doesn't look as important, but it burdens authors and reviewers constantly, making them to keep an eye on it.

On larger timescale, unless there are other important problems, I believe that getting rid of "eternal" issue is worth it, and eventually has to be done.


Regarding arguments that usually we have to do extra steps while using git blame anyway and usually we don't want to hide those steps: it is applicable to current state of repository, but might be changed if a churn happens in the future.

I've tried to emulate potential issue by making a copy of repository with grotesque churn (by messing with intent and quotes eslint rules and reverting back) injected at 2022-04-01, and .git-blame-ignore-revs pushed at 2022-06-28. For example, lib/assert.js without and with this feature added. I hope it helps to decide if churn can disrupt gitblaming workflow.

Currently I'm seeing two issues:

  1. This feature still can't be toggled off in GitHub UI. I'm not sure if there is any non-ill-intentioned situation where anyone wants to hide a commit without possibility to unhide it. Perhaps it should be fixed on GH side.
    Lack of option to turn it off would block ignoring commits that have non-epsilon chance to be wanted by someone.
  2. Some lines (for example, 165-166 or 170) still show commits that are supposed to be ignored.
    Regular git blame in terminal does the same.

Also worth pointing out that blame looks for ignore-revs file on "current" commit, so the file might be outdated or missing. It means that commits-to-be-hidden should be added as soon as possible to make it effective, and adding very old commits might not be useful.

Tl;dr I think it would be a good idea to add this file early but to not populate it with even slightly controversal commits at least until this feature becomes optional. Each commit candidate can be discussed individually later.

@RaisinTen
Copy link
Contributor Author

I don't feel strongly about doing this anymore but if anyone else does, please feel free to take over the task of adding this file!

@RaisinTen RaisinTen closed this Jun 29, 2022
@RaisinTen RaisinTen removed the tsc-agenda Issues and PRs to discuss during the meetings of the TSC. label Jun 29, 2022
@RaisinTen RaisinTen deleted the add-.git-blame-ignore-revs branch June 29, 2022 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.