-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add .git-blame-ignore-revs file #881
Conversation
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.
Nice! Setting it globally in the git config is problematic though: https://stackoverflow.com/questions/70435937/git-blame-with-optional-ignorerevsfile
CONTRIBUTING.md
Outdated
|
||
## Improving `git blame` | ||
|
||
You can have `git blame` ignore the reformatting done when [introducting fourmolu](https://github.com/IntersectMBO/cardano-cli/pull/835/commits/9d1fd093071278be77428dba189d958d5b7a7aeb) by setting this in your `.git/config` file: |
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.
I think this should be set on a per repo basis instead of globally - not every repo has .git-blame-ignore-revs and if it doesn't, it breaks git blame
:
$ git blame flake.nix
fatal: could not open object name list: .git-blame-ignore-revs
I think it would be better to recommend this command git config --local blame.ignoreRevsFile .git-blame-ignore-revs
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.
@carbolymer> yep I meant the repository's local git config file (i.e. .git/config
, as opposed to the global .gitconfig
), but anyway, it's better to give the command than the snippet; so I changed 👍
c1c0b94
to
fcdadf7
Compare
Changelog
Context
#835 and in particular commit
9d1fd09
(#835) changed the formatting of all files, erasing thegit blame
history.This PR uses .git-blame-ignore-revs to fix that in
vscode
. You can also set the blame.ignoreRevsFile option in your.git/config
for terminal calls togit blame
to use this file, like this:How to trust this PR
GitHub
GitHub honors the
.git-blame-ignore-revs
file, as visible here: https://github.com/IntersectMBO/cardano-cli/blame/ec2fd8de4e123ccb45afc866880171963b82cb5f/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hsgitlens
Compare the behavior of
gitlens
invscode
before and after this PR:I could not find a reference that
gitlens
honors the.git-blame-igonre-revs
file (I could only find references of people requesting it, and explanations how to setup the corresponding option), but it actually does, as the screenshots above show.CONTRIBUTING.MD
Please see the rendered version: https://github.com/IntersectMBO/cardano-cli/blob/smelc/git-blame-ignore-reformatting/CONTRIBUTING.md#improving-git-blame