2 # Copyright (c) 2006, Junio C Hamano.
4 test_description='Per branch config variables affects "git fetch".
12 test_expect_success setup '
13 echo >file original &&
15 git commit -a -m original'
17 test_expect_success "clone and setup child repos" '
20 echo >file updated by one &&
21 git commit -a -m "updated by one" &&
25 git config branch.master.remote one &&
26 git config remote.one.url ../one/.git/ &&
27 git config remote.one.fetch refs/heads/master:refs/heads/one &&
31 git config branch.master.remote two &&
32 git config branch.master.merge refs/heads/one &&
33 mkdir -p .git/remotes &&
35 echo "URL: ../two/.git/"
36 echo "Pull: refs/heads/master:refs/heads/two"
37 echo "Pull: refs/heads/one:refs/heads/one"
41 test_expect_success "fetch test" '
43 echo >file updated by origin &&
44 git commit -a -m "updated by origin" &&
47 test -f .git/refs/heads/one &&
48 mine=`git rev-parse refs/heads/one` &&
49 his=`cd ../one && git rev-parse refs/heads/master` &&
50 test "z$mine" = "z$his"
53 test_expect_success "fetch test for-merge" '
57 test -f .git/refs/heads/two &&
58 test -f .git/refs/heads/one &&
59 master_in_two=`cd ../two && git rev-parse master` &&
60 one_in_two=`cd ../two && git rev-parse one` &&
62 echo "$master_in_two not-for-merge"
65 cut -f -2 .git/FETCH_HEAD >actual &&
68 test_expect_success 'fetch following tags' '
71 git tag -a -m 'annotated' anno HEAD &&
78 git fetch .. :track &&
79 git show-ref --verify refs/tags/anno &&
80 git show-ref --verify refs/tags/light