We actually do not need any \0 delimeter because '\n' is an invalid
character in file names. So, simply switch to '\n' delimeted output.
This helps with Mac OS X compatibility because there grep might not have
the -z (--null-data) option and can thus not correctly match null
terminated input...
{
LAST_MERGE_COMMIT="$(git log --format="%H" --merges --max-count=1 master)"
- ( git ls-files -z --others --exclude-standard -- ${1};
- git diff -z --name-only $LAST_MERGE_COMMIT -- ${1} )|
- sort -zu |
- grep -zE "^${2}$" |
- xargs --no-run-if-empty -0 -n 1 -P 10 -I {} bash -c "${3} {}"
+ ( git ls-files --others --exclude-standard -- ${1};
+ git diff --name-only $LAST_MERGE_COMMIT -- ${1} )|
+ sort -u |
+ grep -E "^${2}$" |
+ xargs --no-run-if-empty -d '\n' -n 1 -P 10 -I {} bash -c "${3} {}"
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams