git-svn: enable common fetch/commit options for dcommit
[git/gitweb.git] / t / t5510-fetch.sh
blob90eeeba2a31949a84daeb34b1996eaa4818321e6
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 &&
26 git repo-config remote.one.url ../one/.git/ &&
27 git repo-config remote.one.fetch refs/heads/master:refs/heads/one &&
28 cd .. &&
29 git clone . three &&
30 cd three &&
31 git repo-config branch.master.remote two &&
32 git repo-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"
38 } >.git/remotes/two
41 test_expect_success "fetch test" '
42 cd "$D" &&
43 echo >file updated by origin &&
44 git commit -a -m "updated by origin" &&
45 cd two &&
46 git fetch &&
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" '
54 cd "$D" &&
55 cd three &&
56 git fetch &&
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"
63 echo "$one_in_two "
64 } >expected &&
65 cut -f -2 .git/FETCH_HEAD >actual &&
66 diff expected actual'
68 test_expect_success 'fetch following tags' '
70 cd "$D" &&
71 git tag -a -m 'annotated' anno HEAD &&
72 git tag light HEAD &&
74 mkdir four &&
75 cd four &&
76 git init-db &&
78 git fetch .. :track &&
79 git show-ref --verify refs/tags/anno &&
80 git show-ref --verify refs/tags/light
84 test_done