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

ignore "maintenance" user #94

Open
KrisThielemans opened this issue Feb 7, 2024 · 3 comments
Open

ignore "maintenance" user #94

KrisThielemans opened this issue Feb 7, 2024 · 3 comments

Comments

@KrisThielemans
Copy link

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.

@casperdcl
Copy link
Owner

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>"

@KrisThielemans
Copy link
Author

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!

@casperdcl
Copy link
Owner

casperdcl commented May 16, 2024

Sorry for the confusion - I was referring to two different things.

  • manually using --author when committing bot-like things
  • .git-blame-ignore-revs (via git fame --ignore-revs-file or git 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants