3 test_description='commit --pathspec-from-file'
9 test_expect_success setup '
17 git add fileA.t fileB.t fileC.t fileD.t
20 restore_checkpoint () {
21 git reset --soft checkpoint
25 git diff-tree --no-commit-id --name-status -r HEAD >actual &&
26 test_cmp expect actual
29 test_expect_success '--pathspec-from-file from stdin' '
32 echo fileA.t | git commit --pathspec-from-file=- -m "Commit" &&
34 cat >expect <<-\EOF &&
40 test_expect_success '--pathspec-from-file from file' '
44 git commit --pathspec-from-file=list -m "Commit" &&
46 cat >expect <<-\EOF &&
52 test_expect_success 'NUL delimiters' '
55 printf "fileA.t\0fileB.t\0" | git commit --pathspec-from-file=- --pathspec-file-nul -m "Commit" &&
57 cat >expect <<-\EOF &&
64 test_expect_success 'LF delimiters' '
67 printf "fileA.t\nfileB.t\n" | git commit --pathspec-from-file=- -m "Commit" &&
69 cat >expect <<-\EOF &&
76 test_expect_success 'no trailing delimiter' '
79 printf "fileA.t\nfileB.t" | git commit --pathspec-from-file=- -m "Commit" &&
81 cat >expect <<-\EOF &&
88 test_expect_success 'CRLF delimiters' '
91 printf "fileA.t\r\nfileB.t\r\n" | git commit --pathspec-from-file=- -m "Commit" &&
93 cat >expect <<-\EOF &&
100 test_expect_success 'quotes' '
101 restore_checkpoint &&
107 git commit --pathspec-from-file=list -m "Commit" &&
109 cat >expect <<-\EOF &&
115 test_expect_success 'quotes not compatible with --pathspec-file-nul' '
116 restore_checkpoint &&
122 test_must_fail git commit --pathspec-from-file=list --pathspec-file-nul -m "Commit"
125 test_expect_success 'only touches what was listed' '
126 restore_checkpoint &&
128 printf "fileB.t\nfileC.t\n" | git commit --pathspec-from-file=- -m "Commit" &&
130 cat >expect <<-\EOF &&
137 test_expect_success 'error conditions' '
138 restore_checkpoint &&
139 echo fileA.t >list &&
142 test_must_fail git commit --pathspec-from-file=list --interactive -m "Commit" 2>err &&
143 test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
145 test_must_fail git commit --pathspec-from-file=list --patch -m "Commit" 2>err &&
146 test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
148 test_must_fail git commit --pathspec-from-file=list --all -m "Commit" 2>err &&
149 test_i18ngrep -e "--pathspec-from-file with -a does not make sense" err &&
151 test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err &&
152 test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
154 test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
155 test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
157 test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err &&
158 test_i18ngrep -e "No paths with --include/--only does not make sense." err &&
160 test_must_fail git commit --pathspec-from-file=empty_list --only -m "Commit" 2>err &&
161 test_i18ngrep -e "No paths with --include/--only does not make sense." err