3 # Copyright (c) 2007 Santi BĂ©jar, based on t4013 by Junio C Hamano
7 test_description='Merge logic in fetch'
14 test_expect_success setup '
15 GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
16 GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
17 export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
19 echo >file original &&
21 git commit -a -m One &&
23 git tag tag-one-tree HEAD^{tree} &&
27 git commit -a -m Two &&
28 git tag -a -m "Tag Two" tag-two &&
32 git commit -a -m Three &&
33 git tag -a -m "Tag Three" tag-three &&
34 git tag -a -m "Tag Three file" tag-three-file HEAD^{tree}:file &&
37 echo master >> file &&
38 git commit -a -m Master &&
39 git tag -a -m "Tag Master" tag-master &&
45 git config remote.origin.url ../.git/ &&
47 git config remote.config-explicit.url ../.git/ &&
48 git config remote.config-explicit.fetch refs/heads/master:remotes/rem/master &&
49 git config --add remote.config-explicit.fetch refs/heads/one:remotes/rem/one &&
50 git config --add remote.config-explicit.fetch two:remotes/rem/two &&
51 git config --add remote.config-explicit.fetch refs/heads/three:remotes/rem/three &&
52 remotes="config-explicit" &&
54 git config remote.config-glob.url ../.git/ &&
55 git config remote.config-glob.fetch refs/heads/*:refs/remotes/rem/* &&
56 remotes="$remotes config-glob" &&
58 mkdir -p .git/remotes &&
61 echo "Pull: refs/heads/master:remotes/rem/master"
62 echo "Pull: refs/heads/one:remotes/rem/one"
63 echo "Pull: two:remotes/rem/two"
64 echo "Pull: refs/heads/three:remotes/rem/three"
65 } >.git/remotes/remote-explicit &&
66 remotes="$remotes remote-explicit" &&
70 echo "Pull: refs/heads/*:refs/remotes/rem/*"
71 } >.git/remotes/remote-glob &&
72 remotes="$remotes remote-glob" &&
74 mkdir -p .git/branches &&
75 echo "../.git" > .git/branches/branches-default &&
76 remotes="$remotes branches-default" &&
78 echo "../.git#one" > .git/branches/branches-one &&
79 remotes="$remotes branches-one" &&
81 for remote in $remotes ; do
82 git config branch.br-$remote.remote $remote &&
83 git config branch.br-$remote-merge.remote $remote &&
84 git config branch.br-$remote-merge.merge refs/heads/three &&
85 git config branch.br-$remote-octopus.remote $remote &&
86 git config branch.br-$remote-octopus.merge refs/heads/one &&
87 git config --add branch.br-$remote-octopus.merge two &&
88 git config --add branch.br-$remote-octopus.merge remotes/rem/three
92 # Merge logic depends on branch properties and Pull: or .fetch lines
93 for remote in $remotes ; do
94 for branch in "" "-merge" "-octopus" ; do
97 br-$remote$branch $remote
102 # Merge logic does not depend on branch properties,
103 # but does depend on Pull: or fetch lines.
104 # Use two branches completely unrelated from the arguments,
105 # the clone default and one without branch properties
106 for branch in master br-unconfig ; do
108 for remote in $remotes ; do
113 # Merge logic does not depend on branch properties
114 # neither in the Pull: or .fetch config
115 for branch in master br-unconfig ; do
119 $branch ../.git one two
120 $branch --tags ../.git
121 $branch ../.git tag tag-one tag tag-three
122 $branch ../.git tag tag-one-tree tag tag-three-file
123 $branch ../.git one tag tag-one tag tag-three-file
130 '' | '#'*) continue ;;
132 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
133 cnt=`expr $test_count + 1`
134 pfx=`printf "%04d" $cnt`
135 expect="../../t5515/fetch.$test"
136 actual="$pfx-fetch.$test"
138 test_expect_success "$cmd" '
142 git symbolic-ref HEAD refs/heads/$1 ; shift
143 rm -f .git/FETCH_HEAD
144 rm -f .git/refs/heads/*
145 rm -f .git/refs/remotes/rem/*
146 rm -f .git/refs/tags/*
147 git fetch "$@" >/dev/null
152 git diff -u "$expect" "$actual" &&
155 # this is to help developing new tests.
156 cp "$actual" "$expect"