sk- / git-lint

improving source code one step at a time
Apache License 2.0
236 stars 78 forks source link

warning: xargs: illegal option -- - #153

Open thibaut-pro opened 4 years ago

thibaut-pro commented 4 years ago

I get the follow warning when running the git pre-commit hook:

xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]

This is on MacOS. Any tips on how to address that?

thibaut-pro commented 4 years ago

Replacing

# First part return the files being commited, excluding deleted files.
git diff-index -z --cached HEAD --name-only --diff-filter=ACMRTUXB |
xargs --null --no-run-if-empty git lint;

with

git lint;

in the pre-commit hook fixed it for me.

sk- commented 4 years ago

@thibaut-singlefile Thanks for the report. It's rather hard to maintain these scripts across oses. I started the development while I was using Linux, and then there were some PRs to fix it for mac. But is not that straightforward. That is one of the reasons, I'd like to get rid of them, and instead change the CLI so that it's easier to integrate in custom hooks.