This one works a bit better for me, YMMV: wget https://gist.githubusercontent.com/henryr/e89f9724eb85a6d5ea48ff0027f36793/raw/2dd7888d7494cc4d38fb3f51581b503bf25b6c7c/pre-commit -O ${IMPALA_HOME}/.git/hooks/pre-commit
On 19 September 2016 at 14:46, Henry Robinson <[email protected]> wrote: > Uhhh, scratch that - this doesn't actually commit the changes. I'll work > on a better version and post it when ready. > > On 19 September 2016 at 13:36, Henry Robinson <[email protected]> wrote: > >> 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/e89f9724eb85a6d5ea >> 48ff0027f36793/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 >> > > > > -- > Henry Robinson > Software Engineer > Cloudera > 415-994-6679 > -- Henry Robinson Software Engineer Cloudera 415-994-6679
