Merge branch 'mh/split-under-lock'
Further preparatory work on the refs API before the pluggable backend series can land. * mh/split-under-lock: (33 commits) lock_ref_sha1_basic(): only handle REF_NODEREF mode commit_ref_update(): remove the flags parameter lock_ref_for_update(): don't resolve symrefs lock_ref_for_update(): don't re-read non-symbolic references refs: resolve symbolic refs first ref_transaction_update(): check refname_is_safe() at a minimum unlock_ref(): move definition higher in the file lock_ref_for_update(): new function add_update(): initialize the whole ref_update verify_refname_available(): adjust constness in declaration refs: don't dereference on rename refs: allow log-only updates delete_branches(): use resolve_refdup() ref_transaction_commit(): correctly report close_ref() failure ref_transaction_create(): disallow recursive pruning refs: make error messages more consistent lock_ref_sha1_basic(): remove unneeded local variable read_raw_ref(): move docstring to header file read_raw_ref(): improve docstring read_raw_ref(): rename symref argument to referent ...
This commit is contained in:
@ -23,7 +23,7 @@ test_expect_success setup '
|
||||
m=refs/heads/master
|
||||
n_dir=refs/heads/gu
|
||||
n=$n_dir/fixes
|
||||
outside=foo
|
||||
outside=refs/foo
|
||||
|
||||
test_expect_success \
|
||||
"create $m" \
|
||||
@ -479,7 +479,7 @@ test_expect_success 'stdin fails with duplicate refs' '
|
||||
create $a $m
|
||||
EOF
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
grep "fatal: Multiple updates for ref '"'"'$a'"'"' not allowed." err
|
||||
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin create ref works' '
|
||||
@ -880,7 +880,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
|
||||
test_expect_success 'stdin -z fails with duplicate refs' '
|
||||
printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
|
||||
test_must_fail git update-ref -z --stdin <stdin 2>err &&
|
||||
grep "fatal: Multiple updates for ref '"'"'$a'"'"' not allowed." err
|
||||
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin -z create ref works' '
|
||||
@ -1102,6 +1102,41 @@ test_expect_success 'stdin -z delete refs works with packed and loose refs' '
|
||||
test_must_fail git rev-parse --verify -q $c
|
||||
'
|
||||
|
||||
test_expect_success 'fails with duplicate HEAD update' '
|
||||
git branch target1 $A &&
|
||||
git checkout target1 &&
|
||||
cat >stdin <<-EOF &&
|
||||
update refs/heads/target1 $C
|
||||
option no-deref
|
||||
update HEAD $B
|
||||
EOF
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
|
||||
echo "refs/heads/target1" >expect &&
|
||||
git symbolic-ref HEAD >actual &&
|
||||
test_cmp expect actual &&
|
||||
echo "$A" >expect &&
|
||||
git rev-parse refs/heads/target1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'fails with duplicate ref update via symref' '
|
||||
git branch target2 $A &&
|
||||
git symbolic-ref refs/heads/symref2 refs/heads/target2 &&
|
||||
cat >stdin <<-EOF &&
|
||||
update refs/heads/target2 $C
|
||||
update refs/heads/symref2 $B
|
||||
EOF
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
|
||||
echo "refs/heads/target2" >expect &&
|
||||
git symbolic-ref refs/heads/symref2 >actual &&
|
||||
test_cmp expect actual &&
|
||||
echo "$A" >expect &&
|
||||
git rev-parse refs/heads/target2 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
run_with_limited_open_files () {
|
||||
(ulimit -n 32 && "$@")
|
||||
}
|
||||
|
Reference in New Issue
Block a user