aboutsummaryrefslogtreecommitdiffstats
path: root/t/t7526-commit-pathspec-file.sh
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>2019-12-30 15:38:38 +0000
committerJunio C Hamano <gitster@pobox.com>2020-01-15 12:14:15 -0800
commitf94f7bd00d06c6b651a0e7afcc90ac86cc5f391b (patch)
tree2e587cabe5d5761b42479187464405f7e6dc60c5 /t/t7526-commit-pathspec-file.sh
parentGit 2.25 (diff)
downloadgit-f94f7bd00d06c6b651a0e7afcc90ac86cc5f391b.tar.gz
git-f94f7bd00d06c6b651a0e7afcc90ac86cc5f391b.zip
t: add tests for error conditions with --pathspec-from-file
Also move some old tests into the new tests: it doesn't seem reasonable to have individual error condition tests. Old test for `git commit` was corrected, previously it was instructed to use stdin but wasn't provided with any stdin. While this works at the moment, it's not exactly perfect. Old tests for `git reset` were improved to test for a specific error message. Suggested-By: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7526-commit-pathspec-file.sh')
-rwxr-xr-xt/t7526-commit-pathspec-file.sh27
1 files changed, 24 insertions, 3 deletions
diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh
index 4b58901ed6..336197449f 100755
--- a/t/t7526-commit-pathspec-file.sh
+++ b/t/t7526-commit-pathspec-file.sh
@@ -127,10 +127,31 @@ test_expect_success 'only touches what was listed' '
verify_expect
'
-test_expect_success '--pathspec-from-file and --all cannot be used together' '
+test_expect_success 'error conditions' '
restore_checkpoint &&
- test_must_fail git commit --pathspec-from-file=- --all -m "Commit" 2>err &&
- test_i18ngrep "[-]-pathspec-from-file with -a does not make sense" err
+ echo fileA.t >list &&
+ >empty_list &&
+
+ test_must_fail git commit --pathspec-from-file=list --interactive -m "Commit" 2>err &&
+ test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
+
+ test_must_fail git commit --pathspec-from-file=list --patch -m "Commit" 2>err &&
+ test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
+
+ test_must_fail git commit --pathspec-from-file=list --all -m "Commit" 2>err &&
+ test_i18ngrep -e "--pathspec-from-file with -a does not make sense" err &&
+
+ test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err &&
+ test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+
+ test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
+ test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+
+ test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err &&
+ test_i18ngrep -e "No paths with --include/--only does not make sense." err &&
+
+ test_must_fail git commit --pathspec-from-file=empty_list --only -m "Commit" 2>err &&
+ test_i18ngrep -e "No paths with --include/--only does not make sense." err
'
test_done