Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH 3/2] git-add -a: tests

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:58
Subsystem: the rest · Maintainer: Linus Torvalds

And here is a small test script that makes sure that:

 - both modified and new files are included, and
 - no ignored files are included.

Signed-off-by: Junio C Hamano <redacted>
---
 t/t2202-add-addremove.sh |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/t/t2202-add-addremove.sh b/t/t2202-add-addremove.sh
new file mode 100755
index 0000000..7bf8eda
--- /dev/null
+++ b/t/t2202-add-addremove.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='git add -a'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+	echo .gitignore >expect &&
+	(
+		echo actual
+		echo expect
+		echo ignored
+	) >.gitignore &&
+	git add -a &&
+	test_tick &&
+	git commit -m initial &&
+	git ls-files >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'git add -a' '
+	(
+		echo .gitignore
+		echo not-ignored
+		echo "M	.gitignore"
+		echo "A	not-ignored"
+	) >expect &&
+	>ignored &&
+	>not-ignored &&
+	echo modification >>.gitignore &&
+	git add -a &&
+	git update-index --refresh &&
+	git ls-files >actual &&
+	git diff-index --name-status --cached HEAD >>actual &&
+	test_cmp expect actual
+'
+
+test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help