@@ -2093,14 +2093,15 @@ do
20932093
20942094 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
20952095 format_command $type "update refs/heads/ref2" "$(test_oid 001)" "$head" >>stdin &&
2096- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2096+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
20972097 echo $old_head >expect &&
20982098 git rev-parse refs/heads/ref1 >actual &&
20992099 test_cmp expect actual &&
21002100 echo $head >expect &&
21012101 git rev-parse refs/heads/ref2 >actual &&
21022102 test_cmp expect actual &&
2103- test_grep -q "invalid new value provided" stdout
2103+ test_grep "rejected refs/heads/ref2 $(test_oid 001) $head invalid new value provided" stdout &&
2104+ test_grep "trying to write ref ${SQ}refs/heads/ref2${SQ} with nonexistent object" err
21042105 )
21052106 '
21062107
@@ -2119,14 +2120,15 @@ do
21192120
21202121 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
21212122 format_command $type "update refs/heads/ref2" "$head_tree" "$head" >>stdin &&
2122- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2123+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
21232124 echo $old_head >expect &&
21242125 git rev-parse refs/heads/ref1 >actual &&
21252126 test_cmp expect actual &&
21262127 echo $head >expect &&
21272128 git rev-parse refs/heads/ref2 >actual &&
21282129 test_cmp expect actual &&
2129- test_grep -q "invalid new value provided" stdout
2130+ test_grep "rejected refs/heads/ref2 $head_tree $head invalid new value provided" stdout &&
2131+ test_grep "trying to write non-commit object $head_tree to branch ${SQ}refs/heads/ref2${SQ}" err
21302132 )
21312133 '
21322134
@@ -2143,12 +2145,13 @@ do
21432145
21442146 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
21452147 format_command $type "update refs/heads/ref2" "$old_head" "$head" >>stdin &&
2146- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2148+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
21472149 echo $old_head >expect &&
21482150 git rev-parse refs/heads/ref1 >actual &&
21492151 test_cmp expect actual &&
21502152 test_must_fail git rev-parse refs/heads/ref2 &&
2151- test_grep -q "reference does not exist" stdout
2153+ test_grep "rejected refs/heads/ref2 $old_head $head reference does not exist" stdout &&
2154+ test_grep "cannot lock ref ${SQ}refs/heads/ref2${SQ}: unable to resolve reference ${SQ}refs/heads/ref2${SQ}" err
21522155 )
21532156 '
21542157
@@ -2166,13 +2169,14 @@ do
21662169
21672170 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
21682171 format_command $type "update refs/heads/ref2" "$old_head" "$head" >>stdin &&
2169- git update-ref $type --no-deref --stdin --batch-updates <stdin >stdout &&
2172+ git update-ref $type --no-deref --stdin --batch-updates <stdin >stdout 2>err &&
21702173 echo $old_head >expect &&
21712174 git rev-parse refs/heads/ref1 >actual &&
21722175 test_cmp expect actual &&
21732176 echo $head >expect &&
21742177 test_must_fail git rev-parse refs/heads/ref2 &&
2175- test_grep -q "reference does not exist" stdout
2178+ test_grep "rejected refs/heads/ref2 $old_head $head reference does not exist" stdout &&
2179+ test_grep "cannot lock ref ${SQ}refs/heads/ref2${SQ}: reference is missing but expected $head" err
21762180 )
21772181 '
21782182
@@ -2190,15 +2194,16 @@ do
21902194
21912195 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
21922196 format_command $type "symref-update refs/heads/ref2" "$old_head" "ref" "refs/heads/nonexistent" >>stdin &&
2193- git update-ref $type --no-deref --stdin --batch-updates <stdin >stdout &&
2197+ git update-ref $type --no-deref --stdin --batch-updates <stdin >stdout 2>err &&
21942198 echo $old_head >expect &&
21952199 git rev-parse refs/heads/ref1 >actual &&
21962200 test_cmp expect actual &&
21972201 echo $head >expect &&
21982202 echo $head >expect &&
21992203 git rev-parse refs/heads/ref2 >actual &&
22002204 test_cmp expect actual &&
2201- test_grep -q "expected symref but found regular ref" stdout
2205+ test_grep "rejected refs/heads/ref2 $ZERO_OID $ZERO_OID expected symref but found regular ref" stdout &&
2206+ test_grep "cannot lock ref ${SQ}refs/heads/ref2${SQ}: expected symref with target ${SQ}refs/heads/nonexistent${SQ}: but is a regular ref" err
22022207 )
22032208 '
22042209
@@ -2216,14 +2221,15 @@ do
22162221
22172222 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
22182223 format_command $type "update refs/heads/ref2" "$old_head" "$Z" >>stdin &&
2219- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2224+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
22202225 echo $old_head >expect &&
22212226 git rev-parse refs/heads/ref1 >actual &&
22222227 test_cmp expect actual &&
22232228 echo $head >expect &&
22242229 git rev-parse refs/heads/ref2 >actual &&
22252230 test_cmp expect actual &&
2226- test_grep -q "reference already exists" stdout
2231+ test_grep "rejected refs/heads/ref2 $old_head $ZERO_OID reference already exists" stdout &&
2232+ test_grep "cannot lock ref ${SQ}refs/heads/ref2${SQ}: reference already exists" err
22272233 )
22282234 '
22292235
@@ -2241,14 +2247,15 @@ do
22412247
22422248 format_command $type "update refs/heads/ref1" "$old_head" "$head" >stdin &&
22432249 format_command $type "update refs/heads/ref2" "$head" "$old_head" >>stdin &&
2244- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2250+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
22452251 echo $old_head >expect &&
22462252 git rev-parse refs/heads/ref1 >actual &&
22472253 test_cmp expect actual &&
22482254 echo $head >expect &&
22492255 git rev-parse refs/heads/ref2 >actual &&
22502256 test_cmp expect actual &&
2251- test_grep -q "incorrect old value provided" stdout
2257+ test_grep "rejected refs/heads/ref2 $head $old_head incorrect old value provided" stdout &&
2258+ test_grep "cannot lock ref ${SQ}refs/heads/ref2${SQ}: is at $head but expected $old_head" err
22522259 )
22532260 '
22542261
@@ -2264,12 +2271,13 @@ do
22642271 git update-ref refs/heads/ref/foo $head &&
22652272
22662273 format_command $type "update refs/heads/ref/foo" "$old_head" "$head" >stdin &&
2267- format_command $type "update refs/heads/ref" "$old_head" "" >>stdin &&
2268- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2274+ format_command $type "update refs/heads/ref" "$old_head" "$ZERO_OID " >>stdin &&
2275+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
22692276 echo $old_head >expect &&
22702277 git rev-parse refs/heads/ref/foo >actual &&
22712278 test_cmp expect actual &&
2272- test_grep -q "refname conflict" stdout
2279+ test_grep "rejected refs/heads/ref $old_head $ZERO_OID refname conflict" stdout &&
2280+ test_grep "${SQ}refs/heads/ref/foo${SQ} exists; cannot create ${SQ}refs/heads/ref${SQ}" err
22732281 )
22742282 '
22752283
@@ -2284,13 +2292,14 @@ do
22842292 head=$(git rev-parse HEAD) &&
22852293 git update-ref refs/heads/ref/foo $head &&
22862294
2287- format_command $type "update refs/heads/foo" "$old_head" "" >stdin &&
2288- format_command $type "update refs/heads/ref" "$old_head" "" >>stdin &&
2289- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2295+ format_command $type "update refs/heads/foo" "$old_head" "$ZERO_OID " >stdin &&
2296+ format_command $type "update refs/heads/ref" "$old_head" "$ZERO_OID " >>stdin &&
2297+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
22902298 echo $old_head >expect &&
22912299 git rev-parse refs/heads/foo >actual &&
22922300 test_cmp expect actual &&
2293- test_grep -q "refname conflict" stdout
2301+ test_grep "rejected refs/heads/ref $old_head $ZERO_OID refname conflict" stdout &&
2302+ test_grep "${SQ}refs/heads/ref/foo${SQ} exists; cannot create ${SQ}refs/heads/ref${SQ}" err
22942303 )
22952304 '
22962305
@@ -2309,14 +2318,15 @@ do
23092318 format_command $type "create refs/heads/ref" "$old_head" &&
23102319 format_command $type "create refs/heads/Foo" "$old_head"
23112320 } >stdin &&
2312- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2321+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
23132322
23142323 echo $head >expect &&
23152324 git rev-parse refs/heads/foo >actual &&
23162325 echo $old_head >expect &&
23172326 git rev-parse refs/heads/ref >actual &&
23182327 test_cmp expect actual &&
2319- test_grep -q "reference conflict due to case-insensitive filesystem" stdout
2328+ test_grep "rejected refs/heads/Foo $old_head $ZERO_OID reference conflict due to case-insensitive filesystem" stdout &&
2329+ test_grep -e "cannot lock ref ${SQ}refs/heads/Foo${SQ}: Unable to create" -e "Foo.lock" err
23202330 )
23212331 '
23222332
23572367 git symbolic-ref refs/heads/symbolic refs/heads/non-existent &&
23582368
23592369 format_command $type "delete refs/heads/symbolic" "$head" >stdin &&
2360- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2361- test_grep "reference does not exist" stdout
2370+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
2371+ test_grep "rejected refs/heads/non-existent $ZERO_OID $head reference does not exist" stdout &&
2372+ test_grep "cannot lock ref ${SQ}refs/heads/symbolic${SQ}: unable to resolve reference ${SQ}refs/heads/non-existent${SQ}" err
23622373 )
23632374 '
23642375
23732384 head=$(git rev-parse HEAD) &&
23742385
23752386 format_command $type "delete refs/heads/new-branch" "$head" >stdin &&
2376- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2377- test_grep "incorrect old value provided" stdout
2387+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
2388+ test_grep "rejected refs/heads/new-branch $ZERO_OID $head incorrect old value provided" stdout &&
2389+ test_grep "cannot lock ref ${SQ}refs/heads/new-branch${SQ}: is at $(git rev-parse new-branch) but expected $head" err
23782390 )
23792391 '
23802392
23872399 head=$(git rev-parse HEAD) &&
23882400
23892401 format_command $type "delete refs/heads/non-existent" "$head" >stdin &&
2390- git update-ref $type --stdin --batch-updates <stdin >stdout &&
2391- test_grep "reference does not exist" stdout
2402+ git update-ref $type --stdin --batch-updates <stdin >stdout 2>err &&
2403+ test_grep "rejected refs/heads/non-existent $ZERO_OID $head reference does not exist" stdout &&
2404+ test_grep "cannot lock ref ${SQ}refs/heads/non-existent${SQ}: unable to resolve reference ${SQ}refs/heads/non-existent${SQ}" err
23922405 )
23932406 '
23942407done
0 commit comments