1#!/bin/sh
2
3test_description='avoiding conflicting update thru symref aliasing'
4
5. ./test-lib.sh
6
7test_expect_success 'setup' '
8 test_commit one &&
9 git clone . src &&
10 git clone src dst1 &&
11 git clone src dst2 &&
12 test_commit two &&
13 ( cd src && git pull )
14'
15
16test_expect_success 'push' '
17 (
18 cd src &&
19 git push ../dst1 "refs/remotes/*:refs/remotes/*"
20 ) &&
21 git ls-remote src "refs/remotes/*" >expect &&
22 git ls-remote dst1 "refs/remotes/*" >actual &&
23 test_cmp expect actual &&
24 ( cd src && git symbolic-ref refs/remotes/origin/HEAD ) >expect &&
25 ( cd dst1 && git symbolic-ref refs/remotes/origin/HEAD ) >actual &&
26 test_cmp expect actual
27'
28
29test_expect_success 'fetch' '
30 (
31 cd dst2 &&
32 git fetch ../src "refs/remotes/*:refs/remotes/*"
33 ) &&
34 git ls-remote src "refs/remotes/*" >expect &&
35 git ls-remote dst2 "refs/remotes/*" >actual &&
36 test_cmp expect actual &&
37 ( cd src && git symbolic-ref refs/remotes/origin/HEAD ) >expect &&
38 ( cd dst2 && git symbolic-ref refs/remotes/origin/HEAD ) >actual &&
39 test_cmp expect actual
40'
41
42test_done