-
-
Notifications
You must be signed in to change notification settings - Fork 26k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gwip alias for some BSD flavors of xargs #2714
Conversation
In my system (debian jessie, xargs 4.4.2) your test makes
What works for me: echo | xargs -r &>/dev/null && XARGS_OPTS="-r" I have tested it with a custom function Finally, (1) the first line could be removed since an undefined variable is empty, and (2) to prevent possible side effects we should EDIT: the |
Awesome feedback, will update soon, thanks. |
|
||
# these aliases commit and uncommit wip branches | ||
# first though, check xargs flavor for -r flag | ||
echo | xargs -r &>/dev/null && XARGS_OPTS+="-r" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor correction: XARGS_OPTS="-r"
😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, if any other file sets that option there may be side-effects.
EDIT: OK, done.
This looks ready 👍 |
Obsoleted by #2790 |
Status: Ready (but testing cannot hurt)
Some BSD flavors of the
xargs
command (eg on Mac OSX) do not support the-r
flag — which is actually a non-standard flag introduced by the GNU flavor ofxargs
. This breaks thegwip
alias in the currentgit
plugin. See #2692 and #2713.The bug was introduced by a869ec9. The original intention was to take care of the possibility that
git ls-files --deleted -z
would not send anything in the pipe. However, the author @bdubertret failed to see that, in that case, only the GNU flavor ofxarg
fails.This is because the GNU flavor does not follow the
xargs
standard, and fails on empty input instead of returning 0 silently: it requires the-r
flag in order to adopt the standard behavior. Apparently, all BSD flavors abide by the standard, and thus need not the-r
flag; some of them (eg FreeBSD) still silently support the flag for the sake of compatibility, but others (eg Mac OSX) do not and fail in case they see it. Hence this PR.