diff options
Diffstat (limited to 't/t7526-commit-pathspec-file.sh')
-rwxr-xr-x | t/t7526-commit-pathspec-file.sh | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh index 4b58901..c97c550 100755 --- a/t/t7526-commit-pathspec-file.sh +++ b/t/t7526-commit-pathspec-file.sh @@ -2,6 +2,7 @@ test_description='commit --pathspec-from-file' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_tick @@ -100,7 +101,11 @@ test_expect_success 'CRLF delimiters' ' test_expect_success 'quotes' ' restore_checkpoint && - printf "\"file\\101.t\"" | git commit --pathspec-from-file=- -m "Commit" && + cat >list <<-\EOF && + "file\101.t" + EOF + + git commit --pathspec-from-file=list -m "Commit" && cat >expect <<-\EOF && A fileA.t @@ -111,7 +116,10 @@ test_expect_success 'quotes' ' test_expect_success 'quotes not compatible with --pathspec-file-nul' ' restore_checkpoint && - printf "\"file\\101.t\"" >list && + cat >list <<-\EOF && + "file\101.t" + EOF + test_must_fail git commit --pathspec-from-file=list --pathspec-file-nul -m "Commit" ' @@ -127,10 +135,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_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && + + test_must_fail git commit --pathspec-from-file=list --patch -m "Commit" 2>err && + test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && + + test_must_fail git commit --pathspec-from-file=list --all -m "Commit" 2>err && + test_grep -e "options .--pathspec-from-file. and .-a. cannot be used together" err && + + test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + + test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err && + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && + + test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err && + test_grep -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_grep -e "No paths with --include/--only does not make sense." err ' test_done |