3 test_description='pull options'
7 test_expect_success 'setup' '
9 (cd parent && git init &&
10 echo one >file && git add file &&
14 test_expect_success 'git pull -q' '
16 (cd clonedq && git init &&
17 git pull -q "../parent" >out 2>err &&
18 test_must_be_empty err &&
19 test_must_be_empty out)
22 test_expect_success 'git pull -q --rebase' '
24 (cd clonedqrb && git init &&
25 git pull -q --rebase "../parent" >out 2>err &&
26 test_must_be_empty err &&
27 test_must_be_empty out &&
28 git pull -q --rebase "../parent" >out 2>err &&
29 test_must_be_empty err &&
30 test_must_be_empty out)
33 test_expect_success 'git pull' '
35 (cd cloned && git init &&
36 git pull "../parent" >out 2>err &&
38 test_must_be_empty out)
41 test_expect_success 'git pull --rebase' '
43 (cd clonedrb && git init &&
44 git pull --rebase "../parent" >out 2>err &&
46 test_must_be_empty out)
49 test_expect_success 'git pull -v' '
51 (cd clonedv && git init &&
52 git pull -v "../parent" >out 2>err &&
54 test_must_be_empty out)
57 test_expect_success 'git pull -v --rebase' '
59 (cd clonedvrb && git init &&
60 git pull -v --rebase "../parent" >out 2>err &&
62 test_must_be_empty out)
65 test_expect_success 'git pull -v -q' '
67 (cd clonedvq && git init &&
68 git pull -v -q "../parent" >out 2>err &&
69 test_must_be_empty out &&
70 test_must_be_empty err)
73 test_expect_success 'git pull -q -v' '
75 (cd clonedqv && git init &&
76 git pull -q -v "../parent" >out 2>err &&
77 test_must_be_empty out &&
81 test_expect_success 'git pull --force' '
82 mkdir clonedoldstyle &&
83 (cd clonedoldstyle && git init &&
84 cat >>.git/config <<-\EOF &&
87 fetch = refs/heads/master:refs/heads/mirror
90 fetch = refs/heads/master:refs/heads/origin
93 merge = refs/heads/master
97 git branch -f origin &&
98 git pull --all --force
102 test_expect_success 'git pull --all' '
104 (cd clonedmulti && git init &&
105 cat >>.git/config <<-\EOF &&
108 fetch = refs/heads/*:refs/remotes/one/*
111 fetch = refs/heads/*:refs/remotes/two/*
114 merge = refs/heads/master
120 test_expect_success 'git pull --dry-run' '
121 test_when_finished "rm -rf clonedry" &&
125 git pull --dry-run ../parent &&
126 test_path_is_missing .git/FETCH_HEAD &&
127 test_path_is_missing .git/refs/heads/master &&
128 test_path_is_missing .git/index &&
129 test_path_is_missing file
133 test_expect_success 'git pull --all --dry-run' '
134 test_when_finished "rm -rf cloneddry" &&
138 git remote add origin ../parent &&
139 git pull --all --dry-run &&
140 test_path_is_missing .git/FETCH_HEAD &&
141 test_path_is_missing .git/refs/remotes/origin/master &&
142 test_path_is_missing .git/index &&
143 test_path_is_missing file
147 test_expect_success 'git pull --allow-unrelated-histories' '
148 test_when_finished "rm -fr src dst" &&
158 git checkout --orphan side HEAD^ &&
163 test_must_fail git pull ../src side &&
164 git pull --allow-unrelated-histories ../src side
168 test_expect_success 'git pull does not add a sign-off line' '
169 test_when_finished "rm -fr src dst actual" &&
171 test_commit -C src one &&
173 test_commit -C src two &&
174 git -C dst pull --no-ff &&
175 git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
176 test_must_be_empty actual
179 test_expect_success 'git pull --no-signoff does not add sign-off line' '
180 test_when_finished "rm -fr src dst actual" &&
182 test_commit -C src one &&
184 test_commit -C src two &&
185 git -C dst pull --no-signoff --no-ff &&
186 git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
187 test_must_be_empty actual
190 test_expect_success 'git pull --signoff add a sign-off line' '
191 test_when_finished "rm -fr src dst expected actual" &&
192 echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
194 test_commit -C src one &&
196 test_commit -C src two &&
197 git -C dst pull --signoff --no-ff &&
198 git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
199 test_cmp expected actual
202 test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
203 test_when_finished "rm -fr src dst actual" &&
205 test_commit -C src one &&
207 test_commit -C src two &&
208 git -C dst pull --signoff --no-signoff --no-ff &&
209 git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
210 test_must_be_empty actual