3 test_description='Run "stg refresh"'
7 test_expect_success 'Initialize StGit stack' '
9 echo expected.txt >> .git/info/exclude &&
10 echo patches.txt >> .git/info/exclude &&
11 stg new p0 -m "base" &&
13 echo base >> foo$i.txt &&
18 stg new p$i -m "foo $i" &&
19 echo "foo $i" >> foo$i.txt &&
24 cat > expected.txt <<EOF
28 test_expect_success 'Refresh top patch' '
29 echo bar 3 >> foo3.txt &&
32 test -z "$(stg status)" &&
33 stg patches foo3.txt > patches.txt &&
34 diff -u expected.txt patches.txt
37 cat > expected.txt <<EOF
41 test_expect_success 'Refresh middle patch' '
43 echo bar 2 >> foo2.txt &&
46 test -z "$(stg status)" &&
47 stg patches foo2.txt > patches.txt &&
48 diff -u expected.txt patches.txt
51 cat > expected.txt <<EOF
55 test_expect_success 'Refresh bottom patch' '
57 echo bar 1 >> foo1.txt &&
60 test -z "$(stg status)" &&
61 stg patches foo1.txt > patches.txt &&
62 diff -u expected.txt patches.txt
65 test_expect_success 'Refresh moved files' '
66 git mv foo1.txt foo1-new.txt &&