Re: [PATCH v3 1/4] t3431: add rebase --fork-point tests
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2019, 04:38 UTC
- Message-ID
- <xmqq4l79az7j.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190405111513.GU32732@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 21 quoted lines
>> + 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).
Show 15 quoted lines
> 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 >>