X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ft3700-add.sh;h=7d7140db380225bfffd3b64c125e2599b6be77c2;hb=3a3a29c1da97b36dda2761c2e6b61c1a82e20a54;hp=6f031af9f35e4d6350e8e6dd4619d55c66214aa6;hpb=c255a70b5ef4e70070b6076c4308da9d163d56a9;p=git.git diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 6f031af9f..7d7140db3 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -260,4 +260,32 @@ 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 && + test_must_fail 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.err <<\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 +EOF +cat >expect.out <<\EOF +add 'track-this' +EOF + +test_expect_success 'git add --dry-run --ignore-missing of non-existing file' ' + test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err && + test_cmp expect.out actual.out && + test_cmp expect.err actual.err +' + test_done