I recently added a git hook to automatically format my patches with
git-clang-format.

It happens on pre-commit. If the commit is --amend, the script chooses
HEAD~1 to compare against instead of HEAD.

The script is here:

https://gist.github.com/henryr/e89f9724eb85a6d5ea48ff0027f36793

If you want to try it yourself (caveat emptor):

wget
https://gist.githubusercontent.com/henryr/e89f9724eb85a6d5ea48ff0027f36793/raw/cb9316ddeceedff798a143ddaa8d9640ec566da3/pre-commit
-O ${IMPALA_HOME}/.git/hooks/pre-commit
chmod +x ${IMPALA_HOME}/.git/hooks/pre-commit

(Warning, may overwrite any existing pre-commit hook you have).

If we all get to using this or something similar, we'll cut down on all the
review back-and-forth about style and formatting issues, which has to be
worth the time it takes to try out this script.

Henry

Reply via email to