t1404: make D/F conflict tests compatible with reftable backend

Some of the tests in t1404 exercise whether Git correctly aborts transactions when there is a directory/file conflict with ref names. While these tests are all marked to require the "files" backend, they do in fact apply to the "reftable" backend as well. This may not make much sense on the surface: D/F conflicts only exist because the "files" backend uses the filesystem to store loose refs, and thus the restriction theoretically shouldn't apply to the "reftable" backend. But for now, the "reftable" backend artificially restricts the creation of such conflicting refs so that it is a drop-in replacement for the "files" backend. This also ensures that the "reftable" backend can easily be used on the server side without causing issues for clients which only know to use the "files" backend. The only difference between the "files" and "reftable" backends is a slightly different error message. Adapt the tests to accomodate for this difference and remove the REFFILES prerequisite so that we start testing with both backends. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Feb 15, 2024 at 09:25 UTC 3f87bb2c2b83faf7854db293457ed7c275e457e5
1 file changed +17 -20
t/t1404-update-ref-errors.sh
+17 -20
@@ -92,9 +92,6 @@ df_test() {
92 else
93 delname="$delref"
94 fi &&
95 - cat >expected-err <<-EOF &&
96 - fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ
97 - EOF
95 $pack &&
96 if $add_del
97 then
@@ -103,7 +100,7 @@ df_test() {
100 printf "%s\n" "delete $delname" "create $addname $D"
101 fi >commands &&
102 test_must_fail git update-ref --stdin <commands 2>output.err &&
106 - test_cmp expected-err output.err &&
103 + grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err &&
104 printf "%s\n" "$C $delref" >expected-refs &&
105 git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
106 test_cmp expected-refs actual-refs
@@ -191,69 +188,69 @@ test_expect_success 'one new ref is a simple prefix of another' '
188
189 '
190
194 -test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '
191 +test_expect_success 'D/F conflict prevents add long + delete short' '
192 df_test refs/df-al-ds --add-del foo/bar foo
193 '
194
198 -test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '
195 +test_expect_success 'D/F conflict prevents add short + delete long' '
196 df_test refs/df-as-dl --add-del foo foo/bar
197 '
198
202 -test_expect_success REFFILES 'D/F conflict prevents delete long + add short' '
199 +test_expect_success 'D/F conflict prevents delete long + add short' '
200 df_test refs/df-dl-as --del-add foo/bar foo
201 '
202
206 -test_expect_success REFFILES 'D/F conflict prevents delete short + add long' '
203 +test_expect_success 'D/F conflict prevents delete short + add long' '
204 df_test refs/df-ds-al --del-add foo foo/bar
205 '
206
210 -test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' '
207 +test_expect_success 'D/F conflict prevents add long + delete short packed' '
208 df_test refs/df-al-dsp --pack --add-del foo/bar foo
209 '
210
214 -test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' '
211 +test_expect_success 'D/F conflict prevents add short + delete long packed' '
212 df_test refs/df-as-dlp --pack --add-del foo foo/bar
213 '
214
218 -test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' '
215 +test_expect_success 'D/F conflict prevents delete long packed + add short' '
216 df_test refs/df-dlp-as --pack --del-add foo/bar foo
217 '
218
222 -test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' '
219 +test_expect_success 'D/F conflict prevents delete short packed + add long' '
220 df_test refs/df-dsp-al --pack --del-add foo foo/bar
221 '
222
223 # Try some combinations involving symbolic refs...
224
228 -test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' '
225 +test_expect_success 'D/F conflict prevents indirect add long + delete short' '
226 df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
227 '
228
232 -test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' '
229 +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '
230 df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
231 '
232
236 -test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' '
233 +test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '
234 df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
235 '
236
240 -test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' '
237 +test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '
238 df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
239 '
240
244 -test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' '
241 +test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '
242 df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
243 '
244
248 -test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' '
245 +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '
246 df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
247 '
248
252 -test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' '
249 +test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '
250 df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
251 '
252
256 -test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' '
253 +test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '
254 df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
255 '
256