Re: [PATCH v2 03/15] t5520: style fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Thu, Apr 30, 2015 at 5:29 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Fix style funnies in early part of this test script that checks "git
> pull" into an unborn branch.  The primary change is that 'chdir' to
> a newly created empty test repository is now protected by being done
> in a subshell to make it more robust without having to chdir back to
> the original place.
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index 227d293..5195a21 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
>  test_expect_success 'pulling into void' '
> -       mkdir cloned &&
> -       cd cloned &&
> -       git init &&
> -       git pull ..
> -'
> -
> -cd "$D"
> -
> -test_expect_success 'checking the results' '
> +       git init cloned &&
> +       (
> +               cd cloned &&
> +               git pull ..
> +       ) &&
>         test -f file &&
>         test -f cloned/file &&
>         test_cmp file cloned/file
>  '
>
>  test_expect_success 'pulling into void using master:master' '
> -       mkdir cloned-uho &&
> +       git init cloned-uho &&
>         (
>                 cd cloned-uho &&
> -               git init &&
>                 git pull .. master:master
>         ) &&
>         test -f file &&
> @@ -71,7 +62,6 @@ test_expect_success 'pulling into void does not overwrite staged files' '
>         )

I'm currently studying the t5520 tests in order to improve test
coverage of git-pull.sh, and I find it hard to understand whenever
tests depend on the tests before them in subtle ways.

Just wondering, would it be good to clean up the created repos in the
above tests to make it clear that they won't be used anymore?
Something like:

    git init cloned &&
    test_when_finished "rm -rf cloned" &&
    ...

Thanks,
Paul
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]