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 <judge.packham@xxxxxxxxx> --- If anyone feels like pursuing this heres a patch to two simple tests around this behaviour. I made an initial attempt to change builtin-add.c to print an error message and set the exit code to a non-zero value but my naive attempt broke the normal usage of 'git add pathspec'. 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html