On Fri, Apr 05, 2019 at 10:19:59PM +0200, Johannes Schindelin wrote:
> Hi,
> 
> On Fri, 5 Apr 2019, Johannes Schindelin wrote:
> 
> > On Fri, 5 Apr 2019, Johannes Sixt wrote:
> >
> > > Am 05.04.19 um 19:25 schrieb Denton Liu:
> > > > On Fri, Apr 05, 2019 at 04:55:37PM +0200, Johannes Schindelin wrote:
> > > >> On Mon, 1 Apr 2019, Denton Liu wrote:
> > > >>> +test_rebase() {
> > > >>> +     expected="$1" &&
> > > >>> +     shift &&
> > > >>> +     test_expect_success "git rebase $@" "
> > > >>> +             git checkout master &&
> > > >>> +             git reset --hard E &&
> > > >>> +             git checkout side &&
> > > >>> +             git reset --hard G &&
> > > >>> +             git rebase $@ &&
> >
> > > Using $@ in these expansions is wrong. You do not want to forward an
> > > argument list, but you want to construct a command line. $* is correct
> > > here. Then you can remove the single-quotes at the invocation, like so:
> > >
> > >   test_rebase_same_head success
> > >   test_rebase_same_head success --onto B B
> > >
> > > Function test_rebase() could be done in the same way, but the first
> > > argument, expected, still needs quotes at the call site, of course.
> >
> > That's a good idea, let me run with it.
> 
> Indeed, this patch fixes it (see e.g.
> https://dev.azure.com/Git-for-Windows/git/_build/results?buildId=34370):
> 
> -- snipsnap --
> Subject: [PATCH] fixup??? t3431: add rebase --fork-point tests
> 
> Try to fix the Mac build, which currently fails thusly:
> 
>       ++ git reset --hard G
>       HEAD is now at d8775ba G
>       ++ git rebase $'\177'
>       fatal: invalid upstream '?'
>       error: last command exited with $?=128
> 
> Signed-off-by: Johannes Schindelin <johannes.schinde...@gmx.de>
> ---
>  t/t3431-rebase-fork-point.sh | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
> index 4607e65de6..daa0c77467 100755
> --- a/t/t3431-rebase-fork-point.sh
> +++ b/t/t3431-rebase-fork-point.sh
> @@ -29,29 +29,29 @@ test_expect_success setup '
>  test_rebase() {
>       expected="$1" &&
>       shift &&
> -     test_expect_success "git rebase $@" "
> +     test_expect_success "git rebase $*" "
>               git checkout master &&
>               git reset --hard E &&
>               git checkout side &&
>               git reset --hard G &&
> -             git rebase $@ &&
> +             eval git rebase $* &&

The 'eval' is not necessary, all Bash versions down to v3.0 work
without it.

>               test_write_lines $expected >expect &&
>               git log --pretty=%s >actual &&
>               test_cmp expect actual
>       "
>  }
> 
> -test_rebase 'G F E D B A' ''
> -test_rebase 'G F D B A' '--onto D'
> -test_rebase 'G F B A' '--keep-base'
> -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 C B A' '--no-fork-point --keep-base'
> -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 B A' '--fork-point --keep-base 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_rebase 'G F C B A' '--keep-base refs/heads/master'
> +test_rebase 'G F E D B A'
> +test_rebase 'G F D B A' --onto D
> +test_rebase 'G F B A' --keep-base
> +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 C B A' --no-fork-point --keep-base
> +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 B A' --fork-point --keep-base 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_rebase 'G F C B A' --keep-base refs/heads/master
> 
>  test_done
> --
> 2.21.0.windows.1.152.g5895f170b6
> 

Reply via email to