Re: [PATCH] t7012: Implement test for git-checkout

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

 



On Fri, Mar 25, 2016 at 1:36 PM, Chhatoi Pritam Baral
<chhatoipritam@xxxxxxxxx> wrote:
> Previously a TODO, this patch adds a test for git-checkout skipping a
> file with the skip-worktree bit set.

In addition to Torsten's comments...

> diff --git a/t/t7012-skip-worktree-writing.sh
> b/t/t7012-skip-worktree-writing.sh
> @@ -141,6 +141,16 @@ test_expect_success 'git-clean, dirty case' '
>  #TODO test_expect_failure 'git-apply removes file' false
>  #TODO test_expect_failure 'git-mv to skip-worktree' false
>  #TODO test_expect_failure 'git-mv from skip-worktree' false
> -#TODO test_expect_failure 'git-checkout' false
> +
> +test_expect_success 'git-checkout ignores skip-worktree file' '
> +       echo > 1 &&
> +       git commit -m "Add files" &&
> +       echo dirty > 1 &&
> +       echo dirty > 2 &&
> +       git update-index --skip-worktree 1 &&
> +       git checkout -- . &&
> +       grep -q dirty 1 &&
> +       test_must_fail grep -q dirty 2

test_must_fail is for git commands; for system commands, just use '!'
(t/README explains the rationale).

    ! grep -q dirty 2

> +'
>   test_done
--
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]