New policy: Only use test_expect_failure for broken tests
[stgit] / t / t2102-pull-policy-rebase.sh
CommitLineData
e0d32236
YD
1#!/bin/sh
2#
3# Copyright (c) 2007 Yann Dirson
4#
5
0209d767 6test_description='Excercise pull-policy "rebase".'
e0d32236
YD
7
8. ./test-lib.sh
9
e0d32236 10test_expect_success \
0209d767 11 'Fork stack off parent branch, and add patches to the stack' \
e0d32236 12 '
0209d767 13 git branch -m master parent &&
05ec3711 14 stg init &&
0209d767
YD
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
e0d32236
YD
20 '
21
e0d32236 22test_expect_success \
0209d767 23 'Add non-rewinding commit in parent and pull the stack' \
e0d32236 24 '
0209d767
YD
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
e0d32236
YD
29 '
30
e0d32236 31test_expect_success \
0209d767 32 'Rewind/rewrite commit in parent and pull the stack' \
e0d32236 33 '
0209d767
YD
34 stg branch parent && echo b >> file2 && stg refresh &&
35 stg branch stack && stg pull &&
36 test `wc -l <file2` = 2
e0d32236
YD
37 '
38
39# this one exercises the guard against commits
40# (use a new file to avoid mistaking a conflict for a success)
41test_expect_success \
0209d767 42 'New commit in parent and commit a patch in stack' \
e0d32236 43 '
0209d767
YD
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
e0d32236 48 '
5f594e90 49test_expect_success \
0209d767 50 'Try to pull/rebase now that stack base has moved' \
5f594e90 51 '! stg pull'
0209d767
YD
52
53test_expect_success \
54 'Force the pull/rebase, but do not push yet' \
55 'stg pull --force --nopush'
5f594e90 56test_expect_success \
0209d767 57 '...check we lost the committed patch' \
5f594e90
KH
58 '! test -e file'
59test_expect_success \
0209d767 60 '...and check we get a conflict while pushing' \
5f594e90 61 '! stg push'
e0d32236
YD
62
63test_done