Merge branch 'js/merge'
[git/dscho.git] / t / t5510-fetch.sh
bloba11ab0ad41a006f9f20d8ec6172d34e6c7f92d41
1 #!/bin/sh
2 # Copyright (c) 2006, Junio C Hamano.
4 test_description='Per branch config variables affects "git fetch".
8 . ./test-lib.sh
10 D=`pwd`
12 test_expect_success setup '
13 echo >file original &&
14 git add file &&
15 git commit -a -m original'
17 test_expect_success "clone and setup child repos" '
18 git clone . one &&
19 cd one &&
20 echo >file updated by one &&
21 git commit -a -m "updated by one" &&
22 cd .. &&
23 git clone . two &&
24 cd two &&
25 git repo-config branch.master.remote one &&
27 echo "URL: ../one/.git/"
28 echo "Pull: refs/heads/master:refs/heads/one"
29 } >.git/remotes/one
30 cd .. &&
31 git clone . three &&
32 cd three &&
33 git repo-config branch.master.remote two &&
34 git repo-config branch.master.merge refs/heads/one &&
36 echo "URL: ../two/.git/"
37 echo "Pull: refs/heads/master:refs/heads/two"
38 echo "Pull: refs/heads/one:refs/heads/one"
39 } >.git/remotes/two
42 test_expect_success "fetch test" '
43 cd "$D" &&
44 echo >file updated by origin &&
45 git commit -a -m "updated by origin" &&
46 cd two &&
47 git fetch &&
48 test -f .git/refs/heads/one &&
49 mine=`git rev-parse refs/heads/one` &&
50 his=`cd ../one && git rev-parse refs/heads/master` &&
51 test "z$mine" = "z$his"
54 test_expect_success "fetch test for-merge" '
55 cd "$D" &&
56 cd three &&
57 git fetch &&
58 test -f .git/refs/heads/two &&
59 test -f .git/refs/heads/one &&
60 master_in_two=`cd ../two && git rev-parse master` &&
61 one_in_two=`cd ../two && git rev-parse one` &&
63 echo "$master_in_two not-for-merge"
64 echo "$one_in_two "
65 } >expected &&
66 cut -f -2 .git/FETCH_HEAD >actual &&
67 diff expected actual'
69 test_expect_success 'fetch following tags' '
71 cd "$D" &&
72 git tag -a -m 'annotated' anno HEAD &&
73 git tag light HEAD &&
75 mkdir four &&
76 cd four &&
77 git init-db &&
79 git fetch .. :track &&
80 git show-ref --verify refs/tags/anno &&
81 git show-ref --verify refs/tags/light
85 test_done