Skip to content

Commit 3f87bb2

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 129a169 commit 3f87bb2

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

t/t1404-update-ref-errors.sh

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ df_test() {
9292
else
9393
delname="$delref"
9494
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
9895
$pack &&
9996
if $add_del
10097
then
@@ -103,7 +100,7 @@ df_test() {
103100
printf "%s\n" "delete $delname" "create $addname $D"
104101
fi >commands &&
105102
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 &&
107104
printf "%s\n" "$C $delref" >expected-refs &&
108105
git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
109106
test_cmp expected-refs actual-refs
@@ -191,69 +188,69 @@ test_expect_success 'one new ref is a simple prefix of another' '
191188
192189
'
193190

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' '
195192
df_test refs/df-al-ds --add-del foo/bar foo
196193
'
197194

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' '
199196
df_test refs/df-as-dl --add-del foo foo/bar
200197
'
201198

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' '
203200
df_test refs/df-dl-as --del-add foo/bar foo
204201
'
205202

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' '
207204
df_test refs/df-ds-al --del-add foo foo/bar
208205
'
209206

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' '
211208
df_test refs/df-al-dsp --pack --add-del foo/bar foo
212209
'
213210

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' '
215212
df_test refs/df-as-dlp --pack --add-del foo foo/bar
216213
'
217214

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' '
219216
df_test refs/df-dlp-as --pack --del-add foo/bar foo
220217
'
221218

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' '
223220
df_test refs/df-dsp-al --pack --del-add foo foo/bar
224221
'
225222

226223
# Try some combinations involving symbolic refs...
227224

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' '
229226
df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
230227
'
231228

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' '
233230
df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
234231
'
235232

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' '
237234
df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
238235
'
239236

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' '
241238
df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
242239
'
243240

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' '
245242
df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
246243
'
247244

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' '
249246
df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
250247
'
251248

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' '
253250
df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
254251
'
255252

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' '
257254
df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
258255
'
259256

0 commit comments

Comments
 (0)