ignore "maintenance" user
In our repository, we had some commits made by automatic processing (e.g. clang-tidy, clang-format), where we used the --author "maintainer" switch to make clear that this commit isn't really "mine". It'd be nice to be able to tell git fame to ignore this author (i.e. use the author of the previous commit), as now we have a lot of slocs for this maintainer. Presumably this would also happen with pre-commit.ci, although I don't know.
I have no idea if this is possible.
I think you're talking about https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view :)
PS I tend to use --author "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
Sorry @casperdcl can you be more explicit?
The git blame doc refers to fsck.skipList for the format, which says
The path to a list of object names (i.e. one unabbreviated SHA-1 per line) that are known to be broken in a non-fatal way and should be ignored.
I've optimistically tried to add --author="stir_maintenance <[email protected]>" to .git-blame-ignore-revs and do
git blame --ignore-revs-file .git-blame-ignore-revs some_filename
That gives
fatal: invalid object name: --author="stir_maintenance <[email protected]>"
I could imagine creating a script that uses git log to find all hashes from this user to update this file, but that could easily become quite large if we'd run a bot that changes code.
Even if I manage that, I don't know how to pass this to git fame. Maybe by setting blame.ignoreRevsFile?
thanks!
Sorry for the confusion - I was referring to two different things.
- manually using
--authorwhen committing bot-like things .git-blame-ignore-revs(viagit fame --ignore-revs-fileorgit config --local --add blame.ignoreRevsFile) which unfortunately can only contain revisons not authors, so is only intended for infrequent large-scale formatting
I haven't seen any elegant solutions for cases like pre-commit.ci[bot] autofixing lots of external PRs on very active projects.