# [PATCH v3] t7012: Implement test for git-checkout

3 messages from 2016-03-26 to 2016-03-30. Participants: Chhatoi Pritam Baral, Eric Sunshine.
Thread: https://gitlist.dev/t/41834

## Chhatoi Pritam Baral, 2016-03-26 16:37

Subject: [PATCH v3] t7012: Implement test for git-checkout
Message-ID: <56F6BADF.4000005@gmail.com>
URL: https://gitlist.dev/e/56F6BADF.4000005%40gmail.com

```
Previously a TODO; add a test for git-checkout skipping a
file with the skip-worktree bit set.

Signed-off-by: Chhatoi Pritam Baral <chhatoipritam@gmail.com>
---

Replaced test_must_fail around grep with '!', as suggested by Eric.

 t/t7012-skip-worktree-writing.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/t7012-skip-worktree-writing.sh
b/t/t7012-skip-worktree-writing.sh
index 9ceaa40..276f076 100755
--- 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 &&
+	! grep -q dirty 2
+'
  test_done
-- 
2.7.4

```

## Chhatoi Pritam Baral, 2016-03-30 13:29

Subject: Re: [PATCH v3] t7012: Implement test for git-checkout
Message-ID: <56FBD4C9.7080904@gmail.com>
URL: https://gitlist.dev/e/56FBD4C9.7080904%40gmail.com
In-Reply-To: <56F6BADF.4000005@gmail.com>

```
Forgot to mention in the previous message, this is a microproject
for my GSoC '16 application.

(Is that redundant to mention after v1 and v2? )

On 03/26/2016 10:07 PM, Chhatoi Pritam Baral wrote:
> Previously a TODO; add a test for git-checkout skipping a
> file with the skip-worktree bit set.
>
> Signed-off-by: Chhatoi Pritam Baral <chhatoipritam@gmail.com>
> ---
>
> Replaced test_must_fail around grep with '!', as suggested by Eric.
>
>  t/t7012-skip-worktree-writing.sh | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7012-skip-worktree-writing.sh
> b/t/t7012-skip-worktree-writing.sh
> index 9ceaa40..276f076 100755
> --- 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 &&
> +	! grep -q dirty 2
> +'
>   test_done

```

## Eric Sunshine, 2016-03-30 15:21

Subject: Re: [PATCH v3] t7012: Implement test for git-checkout
Message-ID: <CAPig+cSF-8pV08PeVVtRcmoZvV-013MJPmzJ6+hsci5vYsi86Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcSF-8pV08PeVVtRcmoZvV-013MJPmzJ6%2Bhsci5vYsi86Q%40mail.gmail.com
In-Reply-To: <56FBD4C9.7080904@gmail.com>

```
On Wed, Mar 30, 2016 at 9:29 AM, Chhatoi Pritam Baral
<chhatoipritam@gmail.com> wrote:
> Forgot to mention in the previous message, this is a microproject
> for my GSoC '16 application.
>
> (Is that redundant to mention after v1 and v2? )

Readers of v1 knew this since you mentioned with that version, at least.

```
