Fix --authdate date parsing (other formats)
[stgit/kha.git] / t / t2702-refresh-rm.sh
blobd437198d3961b7acb0f196ec4669501f1e060898
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 reset () {
15 stg pop -a > /dev/null
16 git reset --hard > /dev/null
19 test_expect_success 'Initialize StGit stack' '
20 stg init &&
21 echo x > x.txt &&
22 echo y > y.txt &&
23 stg add x.txt y.txt &&
24 git commit -m "Add some files"
27 cat > expected0.txt <<EOF
28 D y.txt
29 EOF
30 printf '' > expected1.txt
31 test_expect_success 'stg rm a file' '
32 stg new -m p0 &&
33 stg rm y.txt &&
34 stg status > status0.txt &&
35 test_cmp expected0.txt status0.txt &&
36 stg refresh &&
37 stg status > status1.txt &&
38 test_cmp expected1.txt status1.txt &&
39 stg files > files.txt &&
40 test_cmp -w expected0.txt files.txt
43 reset
45 cat > expected0.txt <<EOF
46 M x.txt
47 D y.txt
48 EOF
49 printf '' > expected1.txt
50 test_expect_success 'stg rm a file together with other changes' '
51 stg new -m p1 &&
52 echo x2 >> x.txt &&
53 stg rm y.txt &&
54 stg status > status0.txt &&
55 test_cmp expected0.txt status0.txt &&
56 stg refresh &&
57 stg status > status1.txt &&
58 test_cmp expected1.txt status1.txt &&
59 stg files > files.txt &&
60 test_cmp -w expected0.txt files.txt
63 reset
65 cat > expected0.txt <<EOF
66 D y.txt
67 EOF
68 printf '' > expected1.txt
69 test_expect_success 'rm a file' '
70 stg new -m p2 &&
71 rm y.txt &&
72 stg status > status0.txt &&
73 test_cmp expected0.txt status0.txt &&
74 stg refresh &&
75 stg status > status1.txt &&
76 test_cmp expected1.txt status1.txt &&
77 stg files > files.txt &&
78 test_cmp -w expected0.txt files.txt
81 reset
83 cat > expected0.txt <<EOF
84 M x.txt
85 D y.txt
86 EOF
87 printf '' > expected1.txt
88 test_expect_success 'rm a file together with other changes' '
89 stg new -m p3 &&
90 echo x2 >> x.txt &&
91 rm y.txt &&
92 stg status > status0.txt &&
93 test_cmp expected0.txt status0.txt &&
94 stg refresh &&
95 stg status > status1.txt &&
96 test_cmp expected1.txt status1.txt &&
97 stg files > files.txt &&
98 test_cmp -w expected0.txt files.txt
101 test_done