chiark / gitweb /
Let some commands work with detached HEAD
[stgit] / t / t2101-pull-policy-pull.sh
CommitLineData
e0d32236
YD
1#!/bin/sh
2#
3# Copyright (c) 2007 Yann Dirson
4#
5
6test_description='Excercise pull-policy "fetch-rebase".'
7
8. ./test-lib.sh
9
10# don't need this repo, but better not drop it, see t1100
11#rm -rf .git
12
13# Need a repo to clone
14test_create_repo upstream
15
16test_expect_success \
17 'Setup upstream repo, clone it, and add patches to the clone' \
18 '
19 (cd upstream && stg init) &&
20 stg clone upstream clone &&
21 (cd clone &&
22 git repo-config branch.master.stgit.pull-policy pull &&
23 git repo-config --list &&
24 stg new c1 -m c1 &&
25 echo a > file && stg add file && stg refresh
26 )
27 '
28
29test_expect_success \
30 'Add non-rewinding commit upstream and pull it from clone' \
31 '
32 (cd upstream && stg new u1 -m u1 &&
33 echo a > file2 && stg add file2 && stg refresh) &&
34 (cd clone && stg pull) &&
35 test -e clone/file2
36 '
37
38# note: with pre-1.5 Git the clone is not automatically recorded
39# as rewinding, and thus heads/origin is not moved, but the stack
40# is still correctly rebased
41
675394bc 42test_expect_success \
e0d32236
YD
43 'Rewind/rewrite upstream commit and pull it from clone, without --merged' \
44 '
45 (cd upstream && echo b >> file2 && stg refresh) &&
675394bc 46 (cd clone && ! stg pull)
e0d32236
YD
47 '
48
49test_expect_success \
50 '"Solve" the conflict (pretend there is none)' \
51 '(cd clone &&
52 git add file2 && EDITOR=cat git commit)'
53
54test_expect_success \
55 'Push the stack back' \
56 '(cd clone && stg push -a)'
57
58test_done