Thread (12 messages) flat view 12 messages, 4 authors, 2016-06-15
STALE3744d

[PATCH 1/3] test for add with non-existent pathspec

From: Chris Packham <hidden>
Date: 2016-06-15 22:48:12
Subsystem: the rest · Maintainer: Linus Torvalds

Add a test for 'git add -u pathspec' and 'git add pathspec' where
pathspec does not exist. The expected result is that git add exits with
an error message and an appropriate exit code.

This adds 1 expected failure to t/t2200-add-update.sh.

Signed-off-by: Chris Packham <redacted>
---
 t/t2200-add-update.sh |    5 +++++
 t/t3700-add.sh        |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index 9120750..dbabc3c 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -176,4 +176,9 @@ test_expect_success 'add -u resolves unmerged paths' '
 
 '
 
+test_expect_failure 'error out when attempting to add -u non-existent pathspec' '
+	test_must_fail git add -u non-existent &&
+	! (git ls-files | grep "non-existent")
+'
+
 test_done
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 85eb0fb..c77bb71 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -255,4 +255,9 @@ test_expect_success 'git add to resolve conflicts on otherwise ignored path' '
 	git add track-this
 '
 
+test_expect_success 'error out when attempting to add non-existent pathspec' '
+	test_must_fail git add non-existent &&
+	! (git ls-files | grep "non-existent")
+'
+
 test_done
-- 
1.6.4.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help