chiark / gitweb /
stgit.el: Add "d" for a few diff commands, similar to git.el
[stgit] / t / t2702-refresh-rm.sh
CommitLineData
f837ca5e
KH
1#!/bin/sh
2
3test_description='"stg refresh" with removed files'
4
5. ./test-lib.sh
6
7# Ignore our own temp files.
8cat >> .git/info/exclude <<EOF
9expected*.txt
10files*.txt
11status*.txt
12EOF
13
14reset () {
15 stg pop -a > /dev/null
16 git reset --hard > /dev/null
17}
18
19test_expect_success 'Initialize StGit stack' '
20 stg init &&
21 echo x > x.txt &&
22 echo y > y.txt &&
23 git add x.txt y.txt &&
24 git commit -m "Add some files"
25'
26
27cat > expected0.txt <<EOF
28D y.txt
29EOF
30printf '' > expected1.txt
850c3a89 31test_expect_success 'git rm a file' '
f837ca5e
KH
32 stg new -m p0 &&
33 git 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 | sort > files.txt &&
40 test_cmp expected0.txt files.txt
41'
42
43reset
44
45cat > expected0.txt <<EOF
46D y.txt
47M x.txt
48EOF
49printf '' > expected1.txt
850c3a89 50test_expect_success 'git rm a file together with other changes' '
f837ca5e
KH
51 stg new -m p1 &&
52 echo x2 >> x.txt &&
53 git 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 | sort > files.txt &&
60 test_cmp expected0.txt files.txt
61'
62
63reset
64
65cat > expected0.txt <<EOF
66D y.txt
67EOF
68printf '' > expected1.txt
69test_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 | sort > files.txt &&
78 test_cmp expected0.txt files.txt
79'
80
81reset
82
83cat > expected0.txt <<EOF
84D y.txt
85M x.txt
86EOF
87printf '' > expected1.txt
88test_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 | sort > files.txt &&
98 test_cmp expected0.txt files.txt
99'
100
101test_done