I would like to use git filter-repo to format all my c files in my repos history. To format the files I use clang-format
.
Doing this with git filter-branch I know that I could do:
git filter-branch --tree-filter 'find . -type f -iname \*\.cpp -o -iname \*\.hpp | xargs clang-format -i' HEAD
but since git suggests to use git filter-repo instead, I would like to do so. However it is unclear to me which callback function to use?
Cheers!
CodePudding user response:
Alright, I found my answer at the bottom of this cheat sheet.
There exists already a lint-history script which does exactly that. with a .clang-format
file in the root of the git repo the following worked nicely
lint-history --relevant 'return (filename.endswith(b".cpp") or filename.endswith(b".hpp"))' clang-format -style=file:.clang-format -i