2299
test_grep -q "refname conflict" stdout
2300
)
2301
'
2302
+
2303
+ test_expect_success "stdin $type batch-updates delete incorrect symbolic ref" '
2304
+ git init repo &&
2305
+ test_when_finished "rm -fr repo" &&
2306
+ (
2307
+ cd repo &&
2308
+ test_commit c1 &&
2309
+ head=$(git rev-parse HEAD) &&
2310
+ git symbolic-ref refs/heads/symbolic refs/heads/non-existent &&
2311
+
2312
+ format_command $type "delete refs/heads/symbolic" "$head" >stdin &&
2313
+ git update-ref $type --stdin --batch-updates <stdin >stdout &&
2314
+ test_grep "reference does not exist" stdout
2315
+ )
2316
+ '
2317
+
2318
+ test_expect_success "stdin $type batch-updates delete with incorrect old_oid" '
2319
+ git init repo &&
2320
+ test_when_finished "rm -fr repo" &&
2321
+ (
2322
+ cd repo &&
2323
+ test_commit c1 &&
2324
+ git branch new-branch &&
2325
+ test_commit c2 &&
2326
+ head=$(git rev-parse HEAD) &&
2327
+
2328
+ format_command $type "delete refs/heads/new-branch" "$head" >stdin &&
2329
+ git update-ref $type --stdin --batch-updates <stdin >stdout &&
2330
+ test_grep "incorrect old value provided" stdout
2331
+ )
2332
+ '
2333
+
2334
+ test_expect_success "stdin $type batch-updates delete non-existent ref" '
2335
+ git init repo &&
2336
+ test_when_finished "rm -fr repo" &&
2337
+ (
2338
+ cd repo &&
2339
+ test_commit commit &&
2340
+ head=$(git rev-parse HEAD) &&
2341
+
2342
+ format_command $type "delete refs/heads/non-existent" "$head" >stdin &&
2343
+ git update-ref $type --stdin --batch-updates <stdin >stdout &&
2344
+ test_grep "reference does not exist" stdout
2345
+ )
2346
+ '
2347
done
2348
2349
test_expect_success 'update-ref should also create reflog for HEAD' '