-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
STYLE: Add historical bulk changes to git blame ignore #5162
base: master
Are you sure you want to change the base?
STYLE: Add historical bulk changes to git blame ignore #5162
Conversation
5750500
to
e264440
Compare
e264440
to
cd92cf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks, but I'm not sure about the whole Would it not be possible for such a commit to introduce a significant change? I have seen large commits that include some manual changes, possibly introducing unexpected changes. |
@N-Dekker It's not about the number of files really, it's more about the fact that they are STYLE changes
By definition if a change is marked as STYLE then the author is expressing that the change is not significant. These changes are largely not relevant to what one is looking for during a blame. Also, this is all optional because the user can make git blame behave as they wish ( |
@ebrahimebrahim Suppose you want to find out when a particular bug is introduced. In general it might also be introduced by a STYLE commit, right? So you still want to see STYLE commits in a blame.
Very interesting, thanks. I think I want to use that option: For example, when I look at https://github.com/InsightSoftwareConsortium/ITK/blame/master/Modules/Core/Common/include/itkObject.h and press
In the TortoiseGitBlame settings, I don't see how to switch off ignoring revisions either 🤷 |
I'm not familiar with tortoisegit but based on this issue it looks like the As for github I don't see any way to turn it off :/
I guess it comes down to what we feel ought to be the default behavior. If we want the default to be to not ignore style commits then one approach may be to rename the .git-blame-ignore-revs file so that github cannot find it -- then users who want to ignore style commits can explicitly use |
# STYLE: Prefer local initialization | ||
e23a4dbd1d19c3fecd221a25e6f4c5825dc21e00 | ||
# STYLE: Variable can be made constexpr | ||
e1acaf5aa8d23c82594fd1a7cc9282b3c9786b84 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for repeating myself, but I believe that a commit that makes the initialization of variables more local (e23a4db) or adds more constexpr (e1acaf5) might unexpectedly (probably unintendedly) cause some behavior change, and might be relevant when doing a git blame
.
I would rather not ignore anything other than formatting changes (by Python black, clang-format, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is certainly possible as Ebrahim pointed out, but is usually undesirable. We want to make the default more convenient for most people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm maybe the issue is a liberal interpretation of what really counts as a style commit. I agree that those two commits one may well want to include in a blame. I wouldn't have called those "STYLE".
I'll wait to see how if this discussion continues but I'm open to the option renaming .git-blame-ignore-revs
to something that wouldn't be used by default by github's blame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps remove those two commits from the list, under the theory that they shouldn't have been labeled as STYLE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to make the default more convenient for most people.
Why do people use git blame
in the first place? I typically use it to find exactly when a specific feature or bug was introduced. A bug might also be introduced, accidentally, by a STYLE commit. My use case typically involves multiple "blame prior to change XXX/blame previous version" steps, iteratively, to find the relevant code change.
Of course, I may not be like "most people", I don't know. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, with a mature codebase like ITK, a lot of the steps in git blame tracing can be style commits. And when something is hard, no one likes doing it. Style commits are, by definition, not likely to cause problems, but modify a lot of files, and therefore feature in blame tracing prominently. Unless they can be automatically ignored.
I think 100 is too small here -- 1000 files is closer to a "bulk change" in a project as large as ITK. |
Close #2623
In case this needs to be re-done in the future, I used the following script in a python environment with GitPython installed:
The
file_change_threshold
was 100, so the commits being added to the git-blame-ignore are those commits that both start with "STYLE" and that affect at least 100 files.PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.