From 108da0db1277fc2f4820d0a47c02b2c63111f7a5 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Sat, 10 Jul 2010 00:18:38 +0200 Subject: git add: Add the "--ignore-missing" option for the dry run Sometimes it is useful to know if a file or directory will be ignored before it is added to the work tree. An example is "git submodule add", where it would be really nice to be able to fail with an appropriate error message before the submodule is cloned and checked out. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 't') 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 <actual 2>&1) && + test_cmp expect actual +' + test_done -- cgit v1.2.1