3 test_description
='rm --pathspec-from-file'
9 test_expect_success setup
'
14 git add fileA.t fileB.t fileC.t fileD.t &&
15 git commit -m "files" &&
20 restore_checkpoint
() {
21 git
reset --hard checkpoint
25 git status
--porcelain --untracked-files=no
-- fileA.t fileB.t fileC.t fileD.t
>actual
&&
26 test_cmp expect actual
29 test_expect_success
'simplest' '
32 cat >expect <<-\EOF &&
36 echo fileA.t | git rm --pathspec-from-file=- &&
40 test_expect_success
'--pathspec-file-nul' '
43 cat >expect <<-\EOF &&
48 printf "fileA.t\0fileB.t\0" | git rm --pathspec-from-file=- --pathspec-file-nul &&
52 test_expect_success
'only touches what was listed' '
55 cat >expect <<-\EOF &&
60 printf "fileB.t\nfileC.t\n" | git rm --pathspec-from-file=- &&
64 test_expect_success
'error conditions' '
68 test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err &&
69 test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
71 test_must_fail git rm --pathspec-file-nul 2>err &&
72 test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
75 test_must_fail git rm --pathspec-from-file=empty_list 2>err &&
76 test_i18ngrep -e "No pathspec was given. Which files should I remove?" err