[neomutt-devel] clang-format pre-commit hook
Thomas Adam
thomas at xteddy.org
Sun Jun 25 13:57:51 CEST 2017
On Sun, Jun 25, 2017 at 11:37:00AM +0200, Julian Andres Klode wrote:
> result=0
> for file in `git diff-index --cached --name-only HEAD | grep '\.[ch]$'` ; do
You shouldn't need to invoke grep, for instance:
for file in $(git diff-index --cached --name-only HEAD -- **/*.[ch]); do
Plus, any shell which doesn't support $() in favour of backticks shouldn't e
supported by definition.
> clang-format ${file} > ${GIT_DIR}/current_file
> colordiff --label "$file (to be committed)" --label "$file (reformatted)" -u ${file} ${GIT_DIR}/current_file || result=1
colordiff? You can still use git to give you this information.
Whilst the idea of this might be useful for some, chances are it's likely to
get caught through other means; I'd hope when peer-review happens.
-- Thomas Adam
More information about the neomutt-devel
mailing list