Skip to contentSkip to conversation

t7012: Implement test for git-checkout

PATCH In review Chhatoi Pritam Baral 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 t7012: Implement test for git-checkout

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

---

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(-)
(quoted diff) +0 -0

b/t/t7012-skip-worktree-writing.sh
index 9ceaa40..276f076 100755

t/t7012-skip-worktree-writing.sh +11 -1
@@ -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
Signature · 1 line
2.7.4
#1 lore raw

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? )

Quoted 33 lines · Chhatoi Pritam Baral

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

---

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(-)
t/t7012-skip-worktree-writing.sh +11 -1
index 9ceaa40..276f076 100755
@@ -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 lore raw
Quoted 4 lines · Chhatoi Pritam Baral

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.