3 test_description
='rm --pathspec-from-file'
5 TEST_PASSES_SANITIZE_LEAK
=true
10 test_expect_success setup
'
15 git add fileA.t fileB.t fileC.t fileD.t &&
16 git commit -m "files" &&
21 restore_checkpoint
() {
22 git
reset --hard checkpoint
26 git status
--porcelain --untracked-files=no
-- fileA.t fileB.t fileC.t fileD.t
>actual
&&
27 test_cmp expect actual
30 test_expect_success
'simplest' '
33 cat >expect <<-\EOF &&
37 echo fileA.t | git rm --pathspec-from-file=- &&
41 test_expect_success
'--pathspec-file-nul' '
44 cat >expect <<-\EOF &&
49 printf "fileA.t\0fileB.t\0" | git rm --pathspec-from-file=- --pathspec-file-nul &&
53 test_expect_success
'only touches what was listed' '
56 cat >expect <<-\EOF &&
61 printf "fileB.t\nfileC.t\n" | git rm --pathspec-from-file=- &&
65 test_expect_success
'error conditions' '
69 test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err &&
70 test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
72 test_must_fail git rm --pathspec-file-nul 2>err &&
73 test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
76 test_must_fail git rm --pathspec-from-file=empty_list 2>err &&
77 test_i18ngrep -e "No pathspec was given. Which files should I remove?" err