aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-07-19 11:09:38 -0700
committerJunio C Hamano <gitster@pobox.com>2010-07-19 11:09:38 -0700
commit8fbe9b32ce6f5e12ba3f8b9d4e3ccb0b8acf529f (patch)
treedbca21bec678543260588cc3e04cfcacfd8d9ac5 /t
parent8ac3a66702c43386eb580b7a1a8b1a31cd675327 (diff)
parent108da0db1277fc2f4820d0a47c02b2c63111f7a5 (diff)
downloadgit-8fbe9b32ce6f5e12ba3f8b9d4e3ccb0b8acf529f.tar.gz
git-8fbe9b32ce6f5e12ba3f8b9d4e3ccb0b8acf529f.tar.xz
Merge branch 'jl/add-n-ignore-missing'
* jl/add-n-ignore-missing: git add: Add the "--ignore-missing" option for the dry run
Diffstat (limited to 't')
-rwxr-xr-xt/t3700-add.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 6f031af9f..47fbf5362 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -260,4 +260,29 @@ test_expect_success '"add non-existent" should fail' '
! (git ls-files | grep "non-existent")
'
+test_expect_success 'git add --dry-run of existing changed file' "
+ echo new >>track-this &&
+ git add --dry-run track-this >actual 2>&1 &&
+ echo \"add 'track-this'\" | test_cmp - actual
+"
+
+test_expect_success 'git add --dry-run of non-existing file' "
+ echo ignored-file >>.gitignore &&
+ ! (git add --dry-run track-this ignored-file >actual 2>&1) &&
+ echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
+"
+
+cat >expect <<EOF
+The following paths are ignored by one of your .gitignore files:
+ignored-file
+Use -f if you really want to add them.
+fatal: no files added
+add 'track-this'
+EOF
+
+test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
+ !(git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1) &&
+ test_cmp expect actual
+'
+
test_done