Re: [PATCH] t2028: fix minor error and issues in newly-added "worktree move" tests

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

 



On Sun, Mar 4, 2018 at 12:26 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> Recently-added "git worktree move" tests include a minor error and a few
> small issues. Specifically:
>
> * checking non-existence of wrong file ("source" instead of
>   "destination")
>
> * unneeded redirect (">empty")
>
> * unused variable ("toplevel")
>
> * restoring a worktree location by means of a separate test somewhat
>   distant from the test which moved it rather than using
>   test_when_finished() to restore it in a self-contained fashion

Argh... You're right again :) This looks good.

>
> Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
> ---
>
> This patch is built atop nd/worktree-move-reboot in 'next'.
>
> I didn't get around to doing a proper review of nd/worktree-move-reboot
> v2 [1] until after it had graduated to 'next'. Although v2 fixed all the
> issues identified in my review of v1 [2], it introduced a few minor
> issues of its own. This patch addresses those issues.
>
> [1]: https://public-inbox.org/git/20180212094940.23834-1-pclouds@xxxxxxxxx/
> [2]: https://public-inbox.org/git/20180124095357.19645-1-pclouds@xxxxxxxxx/
>
>  t/t2028-worktree-move.sh | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
> index 082368d8c6..d70d13dabe 100755
> --- a/t/t2028-worktree-move.sh
> +++ b/t/t2028-worktree-move.sh
> @@ -75,7 +75,7 @@ test_expect_success 'move worktree' '
>         git worktree move source destination &&
>         test_path_is_missing source &&
>         git worktree list --porcelain | grep "^worktree.*/destination" &&
> -       ! git worktree list --porcelain | grep "^worktree.*/source" >empty &&
> +       ! git worktree list --porcelain | grep "^worktree.*/source" &&
>         git -C destination log --format=%s >actual2 &&
>         echo init >expected2 &&
>         test_cmp expected2 actual2
> @@ -86,10 +86,10 @@ test_expect_success 'move main worktree' '
>  '
>
>  test_expect_success 'move worktree to another dir' '
> -       toplevel="$(pwd)" &&
>         mkdir some-dir &&
>         git worktree move destination some-dir &&
> -       test_path_is_missing source &&
> +       test_when_finished "git worktree move some-dir/destination destination" &&
> +       test_path_is_missing destination &&
>         git worktree list --porcelain | grep "^worktree.*/some-dir/destination" &&
>         git -C some-dir/destination log --format=%s >actual2 &&
>         echo init >expected2 &&
> @@ -100,10 +100,6 @@ test_expect_success 'remove main worktree' '
>         test_must_fail git worktree remove .
>  '
>
> -test_expect_success 'move some-dir/destination back' '
> -       git worktree move some-dir/destination destination
> -'
> -
>  test_expect_success 'remove locked worktree' '
>         git worktree lock destination &&
>         test_when_finished "git worktree unlock destination" &&
> --
> 2.16.2.660.g709887971b
>
-- 
Duy



[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]

  Powered by Linux