3 test_description='add --pathspec-from-file'
9 test_expect_success setup '
17 restore_checkpoint () {
22 git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual &&
23 test_cmp expect actual
26 test_expect_success '--pathspec-from-file from stdin' '
29 echo fileA.t | git add --pathspec-from-file=- &&
31 cat >expect <<-\EOF &&
37 test_expect_success '--pathspec-from-file from file' '
41 git add --pathspec-from-file=list &&
43 cat >expect <<-\EOF &&
49 test_expect_success 'NUL delimiters' '
52 printf "fileA.t\0fileB.t\0" | git add --pathspec-from-file=- --pathspec-file-nul &&
54 cat >expect <<-\EOF &&
61 test_expect_success 'LF delimiters' '
64 printf "fileA.t\nfileB.t\n" | git add --pathspec-from-file=- &&
66 cat >expect <<-\EOF &&
73 test_expect_success 'no trailing delimiter' '
76 printf "fileA.t\nfileB.t" | git add --pathspec-from-file=- &&
78 cat >expect <<-\EOF &&
85 test_expect_success 'CRLF delimiters' '
88 printf "fileA.t\r\nfileB.t\r\n" | git add --pathspec-from-file=- &&
90 cat >expect <<-\EOF &&
97 test_expect_success 'quotes' '
104 git add --pathspec-from-file=list &&
106 cat >expect <<-\EOF &&
112 test_expect_success 'quotes not compatible with --pathspec-file-nul' '
113 restore_checkpoint &&
119 test_must_fail git add --pathspec-from-file=list --pathspec-file-nul
122 test_expect_success 'only touches what was listed' '
123 restore_checkpoint &&
125 printf "fileB.t\nfileC.t\n" | git add --pathspec-from-file=- &&
127 cat >expect <<-\EOF &&
134 test_expect_success 'error conditions' '
135 restore_checkpoint &&
136 echo fileA.t >list &&
139 test_must_fail git add --pathspec-from-file=list --interactive 2>err &&
140 test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
142 test_must_fail git add --pathspec-from-file=list --patch 2>err &&
143 test_i18ngrep -e "--pathspec-from-file is incompatible with --interactive/--patch" err &&
145 test_must_fail git add --pathspec-from-file=list --edit 2>err &&
146 test_i18ngrep -e "--pathspec-from-file is incompatible with --edit" err &&
148 test_must_fail git add --pathspec-from-file=list -- fileA.t 2>err &&
149 test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
151 test_must_fail git add --pathspec-file-nul 2>err &&
152 test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
154 # This case succeeds, but still prints to stderr
155 git add --pathspec-from-file=empty_list 2>err &&
156 test_i18ngrep -e "Nothing specified, nothing added." err