Tests redirect to err file when grepping stderr
[stgit.git] / t / t2702-refresh-rm.sh
blob35fe39e674d31f144a44da04ffdd712a9b4682ae
1 #!/bin/sh
3 test_description='"stg refresh" with removed files'
5 . ./test-lib.sh
7 # Ignore our own temp files.
8 cat >> .git/info/exclude <<EOF
9 expected*.txt
10 files*.txt
11 status*.txt
12 EOF
14 test_expect_success 'Initialize StGit stack' '
15 stg init &&
16 echo x > x.txt &&
17 echo y > y.txt &&
18 stg add x.txt y.txt &&
19 git commit -m "Add some files"
22 cat > expected0.txt <<EOF
23 D y.txt
24 EOF
25 printf '' > expected1.txt
26 cat > expected2.txt <<EOF
27 D y.txt
28 EOF
29 test_expect_success 'stg rm a file' '
30 test_when_finished "stg pop -a; git reset --hard"
31 stg new -m p0 &&
32 stg rm y.txt &&
33 stg status > status0.txt &&
34 test_cmp expected0.txt status0.txt &&
35 stg refresh &&
36 stg status > status1.txt &&
37 test_cmp expected1.txt status1.txt &&
38 stg files > files.txt &&
39 test_cmp expected2.txt files.txt
42 cat > expected0.txt <<EOF
43 M x.txt
44 D y.txt
45 EOF
46 printf '' > expected1.txt
47 cat > expected2.txt <<EOF
48 M x.txt
49 D y.txt
50 EOF
51 test_expect_success 'stg rm a file together with other changes' '
52 test_when_finished "stg pop -a; git reset --hard"
53 stg new -m p1 &&
54 echo x2 >> x.txt &&
55 stg rm y.txt &&
56 stg status > status0.txt &&
57 test_cmp expected0.txt status0.txt &&
58 stg refresh --force &&
59 stg status > status1.txt &&
60 test_cmp expected1.txt status1.txt &&
61 stg files > files.txt &&
62 test_cmp expected2.txt files.txt
65 cat > expected0.txt <<EOF
66 D y.txt
67 EOF
68 printf '' > expected1.txt
69 cat > expected2.txt <<EOF
70 D y.txt
71 EOF
72 test_expect_success 'rm a file' '
73 test_when_finished "stg pop -a; git reset --hard"
74 stg new -m p2 &&
75 rm y.txt &&
76 stg status > status0.txt &&
77 test_cmp expected0.txt status0.txt &&
78 stg refresh &&
79 stg status > status1.txt &&
80 test_cmp expected1.txt status1.txt &&
81 stg files > files.txt &&
82 test_cmp expected2.txt files.txt
85 cat > expected0.txt <<EOF
86 M x.txt
87 D y.txt
88 EOF
89 printf '' > expected1.txt
90 cat > expected2.txt <<EOF
91 M x.txt
92 D y.txt
93 EOF
94 test_expect_success 'rm a file together with other changes' '
95 test_when_finished "stg pop -a; git reset --hard"
96 stg new -m p3 &&
97 echo x2 >> x.txt &&
98 rm y.txt &&
99 stg status > status0.txt &&
100 test_cmp expected0.txt status0.txt &&
101 stg refresh &&
102 stg status > status1.txt &&
103 test_cmp expected1.txt status1.txt &&
104 stg files > files.txt &&
105 test_cmp expected2.txt files.txt
108 test_done