SZEDER Gábor <szeder....@gmail.com> writes:

>> +    test_expect_success "git rebase $@" "
>> +...
>> +            git rebase $@ &&
>> +...
>> +    "
>> +}
>> +
>> +test_rebase 'G F E D B A' ''
>
> It appears that this last empty argument triggers some bug in Bash
> v4.2 and older (and on macOS such an old Bash is the default /bin/sh),
> as it turns that empty argument into something else, which in turn
> fails the test with:
>
>   <...>
>   ++ git rebase $'\177'
>   fatal: invalid upstream '?'
>   error: last command exited with $?=128
>   not ok 2 - git rebase
>
> https://travis-ci.org/git/git/jobs/516070862#L2276
Yeah, every time I see $@ that appears in any form other than "$@"
(i.e. within a pair of double-quotes without anything else in it),
it makes me feel very uneasy.  Shouldn't the argument to the above
"rebase" be spelled $* instead?  I somehow do not think use of $@
there is buying us anything.

Of course, if we were really passing an arg with $IFS character in
it, we could probably eval 'git rebase "$@"' it (with appropriate
quoting to adjust for the surrounding quote pair).

> Omitting that empty argument avoids this issue, and the test still
> checks what it was supposed to.
>
>> +test_rebase 'G F D B A' '--onto D'
>> +test_rebase 'G F C E D B A' '--no-fork-point'
>> +test_rebase 'G F C D B A' '--no-fork-point --onto D'
>> +test_rebase 'G F E D B A' '--fork-point refs/heads/master'
>> +test_rebase 'G F D B A' '--fork-point --onto D refs/heads/master'
>> +test_rebase 'G F C E D B A' 'refs/heads/master'
>> +test_rebase 'G F C D B A' '--onto D refs/heads/master'
>> +
>> +test_done
>> -- 
>> 2.21.0.695.gaf8658f249
>> 

Reply via email to