Code

test for add with non-existent pathspec
authorChris Packham <judge.packham@gmail.com>
Tue, 9 Feb 2010 22:30:48 +0000 (17:30 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Feb 2010 06:53:40 +0000 (22:53 -0800)
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.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2200-add-update.sh
t/t3700-add.sh

index 912075063b9946d38a9ff72621cb80bcf2c05399..2ad2819a345af53ff6ab0b7c28fa313f1a0a5956 100755 (executable)
@@ -176,4 +176,9 @@ test_expect_success 'add -u resolves unmerged paths' '
 
 '
 
+test_expect_success '"add -u non-existent" should fail' '
+       test_must_fail git add -u non-existent &&
+       ! (git ls-files | grep "non-existent")
+'
+
 test_done
index 85eb0fbf96a65ad958422da02ca4975fe687da95..525c9a8fdfb4953612e6946994c8e555f676bfd2 100755 (executable)
@@ -255,4 +255,9 @@ test_expect_success 'git add to resolve conflicts on otherwise ignored path' '
        git add track-this
 '
 
+test_expect_success '"add non-existent" should fail' '
+       test_must_fail git add non-existent &&
+       ! (git ls-files | grep "non-existent")
+'
+
 test_done