Merge branch 'bf/set-head-symref'
When "git fetch $remote" notices that refs/remotes/$remote/HEAD is missing and discovers what branch the other side points with its HEAD, refs/remotes/$remote/HEAD is updated to point to it. * bf/set-head-symref: fetch set_head: handle mirrored bare repositories fetch: set remote/HEAD if it does not exist refs: add create_only option to refs_update_symref_extended refs: add TRANSACTION_CREATE_EXISTS error remote set-head: better output for --auto remote set-head: refactor for readability refs: atomically record overwritten ref in update_symref refs: standardize output of refs_read_symbolic_ref t/t5505-remote: test failure of set-head t/t5505-remote: set default branch to main
This commit is contained in:
@ -44,14 +44,17 @@ test_expect_success setup '
|
||||
'
|
||||
|
||||
cat > test/expect << EOF
|
||||
one/HEAD -> one/main
|
||||
one/main
|
||||
one/side
|
||||
origin/HEAD -> origin/main
|
||||
origin/main
|
||||
origin/side
|
||||
three/HEAD -> three/main
|
||||
three/another
|
||||
three/main
|
||||
three/side
|
||||
two/HEAD -> two/main
|
||||
two/another
|
||||
two/main
|
||||
two/side
|
||||
@ -96,6 +99,7 @@ cat > expect << EOF
|
||||
origin/HEAD -> origin/main
|
||||
origin/main
|
||||
origin/side
|
||||
three/HEAD -> three/main
|
||||
three/another
|
||||
three/main
|
||||
three/side
|
||||
@ -111,8 +115,10 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
|
||||
'
|
||||
|
||||
cat > expect << EOF
|
||||
one/HEAD -> one/main
|
||||
one/main
|
||||
one/side
|
||||
two/HEAD -> two/main
|
||||
two/another
|
||||
two/main
|
||||
two/side
|
||||
@ -140,7 +146,7 @@ test_expect_success 'git fetch --multiple (bad remote names)' '
|
||||
|
||||
test_expect_success 'git fetch --all (skipFetchAll)' '
|
||||
(cd test4 &&
|
||||
for b in $(git branch -r)
|
||||
for b in $(git branch -r | grep -v HEAD)
|
||||
do
|
||||
git branch -r -d $b || exit 1
|
||||
done &&
|
||||
@ -152,11 +158,14 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
|
||||
'
|
||||
|
||||
cat > expect << EOF
|
||||
one/HEAD -> one/main
|
||||
one/main
|
||||
one/side
|
||||
three/HEAD -> three/main
|
||||
three/another
|
||||
three/main
|
||||
three/side
|
||||
two/HEAD -> two/main
|
||||
two/another
|
||||
two/main
|
||||
two/side
|
||||
@ -164,7 +173,7 @@ EOF
|
||||
|
||||
test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
|
||||
(cd test4 &&
|
||||
for b in $(git branch -r)
|
||||
for b in $(git branch -r | grep -v HEAD)
|
||||
do
|
||||
git branch -r -d $b || exit 1
|
||||
done &&
|
||||
@ -220,14 +229,17 @@ test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
|
||||
|
||||
create_fetch_all_expect () {
|
||||
cat >expect <<-\EOF
|
||||
one/HEAD -> one/main
|
||||
one/main
|
||||
one/side
|
||||
origin/HEAD -> origin/main
|
||||
origin/main
|
||||
origin/side
|
||||
three/HEAD -> three/main
|
||||
three/another
|
||||
three/main
|
||||
three/side
|
||||
two/HEAD -> two/main
|
||||
two/another
|
||||
two/main
|
||||
two/side
|
||||
@ -264,6 +276,7 @@ test_expect_success 'git fetch (fetch all remotes with fetch.all = true)' '
|
||||
|
||||
create_fetch_one_expect () {
|
||||
cat >expect <<-\EOF
|
||||
one/HEAD -> one/main
|
||||
one/main
|
||||
one/side
|
||||
origin/HEAD -> origin/main
|
||||
|
Reference in New Issue
Block a user