]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5510-fetch.sh
GIT 1.5.0
[thirdparty/git.git] / t / t5510-fetch.sh
CommitLineData
7be1d62c
JH
1#!/bin/sh
2# Copyright (c) 2006, Junio C Hamano.
3
4test_description='Per branch config variables affects "git fetch".
5
6'
7
8. ./test-lib.sh
9
10D=`pwd`
11
12test_expect_success setup '
13 echo >file original &&
14 git add file &&
15 git commit -a -m original'
16
17test_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 &&
e0d10e1c
TP
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 &&
6cc7c36d
SB
28 cd .. &&
29 git clone . three &&
30 cd three &&
e0d10e1c
TP
31 git config branch.master.remote two &&
32 git config branch.master.merge refs/heads/one &&
75c384ef 33 mkdir -p .git/remotes &&
6cc7c36d
SB
34 {
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
7be1d62c
JH
39'
40
41test_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"
51'
52
6cc7c36d
SB
53test_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` &&
61 {
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'
67
6c96c0f1
JH
68test_expect_success 'fetch following tags' '
69
70 cd "$D" &&
71 git tag -a -m 'annotated' anno HEAD &&
72 git tag light HEAD &&
73
74 mkdir four &&
75 cd four &&
5c94f87e 76 git init &&
6c96c0f1
JH
77
78 git fetch .. :track &&
79 git show-ref --verify refs/tags/anno &&
80 git show-ref --verify refs/tags/light
81
82'
83
7be1d62c 84test_done