Release 0.14.1
[stgit.git] / t / t2700-refresh.sh
blob2e7901c19a92e0aab1f1d19e8212e34890be150b
1 #!/bin/sh
3 test_description='Run "stg refresh"'
5 . ./test-lib.sh
7 test_expect_success 'Initialize StGit stack' '
8 stg init &&
9 echo expected.txt >> .git/info/exclude &&
10 echo patches.txt >> .git/info/exclude &&
11 stg new p0 -m "base" &&
12 for i in 1 2 3; do
13 echo base >> foo$i.txt &&
14 git add foo$i.txt
15 done
16 stg refresh &&
17 for i in 1 2 3; do
18 stg new p$i -m "foo $i" &&
19 echo "foo $i" >> foo$i.txt &&
20 stg refresh
21 done
24 cat > expected.txt <<EOF
27 EOF
28 test_expect_success 'Refresh top patch' '
29 echo bar 3 >> foo3.txt &&
30 stg refresh &&
31 stg status &&
32 test -z "$(stg status)" &&
33 stg patches foo3.txt > patches.txt &&
34 diff -u expected.txt patches.txt
37 cat > expected.txt <<EOF
40 EOF
41 test_expect_success 'Refresh middle patch' '
42 stg status &&
43 echo bar 2 >> foo2.txt &&
44 stg refresh -p p2 &&
45 stg status &&
46 test -z "$(stg status)" &&
47 stg patches foo2.txt > patches.txt &&
48 diff -u expected.txt patches.txt
51 cat > expected.txt <<EOF
54 EOF
55 test_expect_success 'Refresh bottom patch' '
56 stg status &&
57 echo bar 1 >> foo1.txt &&
58 stg refresh -p p1 &&
59 stg status &&
60 test -z "$(stg status)" &&
61 stg patches foo1.txt > patches.txt &&
62 diff -u expected.txt patches.txt
65 test_done