Stop advertising 'pull' as the only operation blocked on protected stacks.
[stgit.git] / t / t2102-pull-policy-rebase.sh
blob41f81685bd5d3db35045189fbbb37a7d8a32cddc
1 #!/bin/sh
3 # Copyright (c) 2007 Yann Dirson
6 test_description='Excercise pull-policy "rebase".'
8 . ./test-lib.sh
10 test_expect_success \
11 'Fork stack off parent branch, and add patches to the stack' \
13 stg init &
14 git branch -m master parent &&
15 stg branch --create stack &&
16 git repo-config branch.stack.stgit.pull-policy rebase &&
17 git repo-config --list &&
18 stg new c1 -m c1 &&
19 echo a > file && stg add file && stg refresh
22 test_expect_success \
23 'Add non-rewinding commit in parent and pull the stack' \
25 stg branch parent && stg new u1 -m u1 &&
26 echo b > file2 && stg add file2 && stg refresh &&
27 stg branch stack && stg pull &&
28 test -e file2
31 test_expect_success \
32 'Rewind/rewrite commit in parent and pull the stack' \
34 stg branch parent && echo b >> file2 && stg refresh &&
35 stg branch stack && stg pull &&
36 test `wc -l <file2` = 2
39 # this one exercises the guard against commits
40 # (use a new file to avoid mistaking a conflict for a success)
41 test_expect_success \
42 'New commit in parent and commit a patch in stack' \
44 stg branch parent && stg new u2 -m u2 &&
45 echo c > file3 && stg add file3 && stg refresh &&
46 stg branch stack && stg commit && stg new c2 -m c2 &&
47 echo a >> file && stg refresh
49 test_expect_failure \
50 'Try to pull/rebase now that stack base has moved' \
51 'stg pull'
53 test_expect_success \
54 'Force the pull/rebase, but do not push yet' \
55 'stg pull --force --nopush'
56 test_expect_failure \
57 '...check we lost the committed patch' \
58 'test -e file'
59 test_expect_failure \
60 '...and check we get a conflict while pushing' \
61 'stg push'
63 test_done