From: Alexandr Miloslavskiy via GitGitGadget Date: Mon, 16 Dec 2019 15:47:50 GMT Subject: [PATCH v2 02/18] t7526: add tests for error conditions Message-ID: In-Reply-To: From: Alexandr Miloslavskiy Suggested-By: Phillip Wood Signed-off-by: Alexandr Miloslavskiy --- t/t7526-commit-pathspec-file.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh index 4e592f7472..68920e8ff9 100755 --- a/t/t7526-commit-pathspec-file.sh +++ b/t/t7526-commit-pathspec-file.sh @@ -61,4 +61,28 @@ test_expect_success 'only touches what was listed' ' verify_expect ' +test_expect_success 'error conditions' ' + restore_checkpoint && + echo fileA.t >list && + >empty_list && + + test_must_fail git commit --pathspec-from-file=- --interactive -m "Commit" err && + test_i18ngrep "\-\-pathspec-from-file is incompatible with \-\-interactive/\-\-patch" err && + + test_must_fail git commit --pathspec-from-file=- --patch -m "Commit" err && + test_i18ngrep "\-\-pathspec-from-file is incompatible with \-\-interactive/\-\-patch" err && + + test_must_fail git commit --pathspec-from-file=- -m "Commit" -- fileA.t err && + test_i18ngrep "\-\-pathspec-from-file is incompatible with pathspec arguments" err && + + test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err && + test_i18ngrep "\-\-pathspec-file-nul requires \-\-pathspec-from-file" err && + + test_must_fail git commit --pathspec-from-file=- --include -m "Commit" err && + test_i18ngrep "No paths with \-\-include/\-\-only does not make sense." err && + + test_must_fail git commit --pathspec-from-file=- --only -m "Commit" err && + test_i18ngrep "No paths with \-\-include/\-\-only does not make sense." err +' + test_done -- gitgitgadget