git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t7012: Implement test for git-checkout
@ 2016-03-25 17:36 Chhatoi Pritam Baral
  2016-03-25 22:32 ` Torsten Bögershausen
  2016-03-25 23:29 ` Eric Sunshine
  0 siblings, 2 replies; 3+ messages in thread
From: Chhatoi Pritam Baral @ 2016-03-25 17:36 UTC (permalink / raw)
  To: git

Previously a TODO, this patch adds a test for git-checkout skipping a
file with the
skip-worktree bit set.

I'm doing this as a microproject for my GSoC '16 application.

Signed-off-by: Chhatoi Pritam Baral <chhatoipritam@gmail.com>
---
 t/t7012-skip-worktree-writing.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t7012: Implement test for git-checkout
  2016-03-25 17:36 [PATCH] t7012: Implement test for git-checkout Chhatoi Pritam Baral
@ 2016-03-25 22:32 ` Torsten Bögershausen
  2016-03-25 23:29 ` Eric Sunshine
  1 sibling, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2016-03-25 22:32 UTC (permalink / raw)
  To: Chhatoi Pritam Baral, git

On 2016-03-25 18.36, Chhatoi Pritam Baral wrote:
Thanks for working on Git.
Some comments inline.
> Previously a TODO, this patch adds a test for git-checkout skipping a
> file with the
> skip-worktree bit set.
Micro-nit: the "this patch ..." may be written shorter:
> Previously a TODO, add a test for git-checkout skipping a
> file with the skip-worktree bit set.

> 
> I'm doing this as a microproject for my GSoC '16 application.
This info is good to have, but doesn't need to stay forever in the
commit message. It may be below (see XXX)
> 
> Signed-off-by: Chhatoi Pritam Baral <chhatoipritam@gmail.com>
> ---
XXX Add additional info here.
>  t/t7012-skip-worktree-writing.sh | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/t/t7012-skip-worktree-writing.sh
> b/t/t7012-skip-worktree-writing.sh
> index 9ceaa40..d5b42d6 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 &&
Style: No space after the '>', like this:
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_done
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t7012: Implement test for git-checkout
  2016-03-25 17:36 [PATCH] t7012: Implement test for git-checkout Chhatoi Pritam Baral
  2016-03-25 22:32 ` Torsten Bögershausen
@ 2016-03-25 23:29 ` Eric Sunshine
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sunshine @ 2016-03-25 23:29 UTC (permalink / raw)
  To: Chhatoi Pritam Baral; +Cc: Git List

On Fri, Mar 25, 2016 at 1:36 PM, Chhatoi Pritam Baral
<chhatoipritam@gmail.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-25 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 17:36 [PATCH] t7012: Implement test for git-checkout Chhatoi Pritam Baral
2016-03-25 22:32 ` Torsten Bögershausen
2016-03-25 23:29 ` Eric Sunshine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).