Add some more tests of "stg status" output
[stgit/ydirson.git] / t / t0002-status.sh
blobd0c31b250926482e113c32b59a9d01cc0cf95b05
1 #!/bin/sh
3 # Copyright (c) 2007 David Kågedal
6 test_description='Basic stg status
8 Test that "stg status" works.'
10 . ./test-lib.sh
11 stg init
13 # Ignore our own output files.
14 cat > .git/info/exclude <<EOF
15 /expected.txt
16 /output.txt
17 EOF
19 cat > expected.txt <<EOF
20 EOF
21 test_expect_success 'Run status on empty' '
22 stg status > output.txt &&
23 diff -u expected.txt output.txt
26 cat > expected.txt <<EOF
27 ? foo
28 EOF
29 test_expect_success 'Status with an untracked file' '
30 touch foo &&
31 stg status > output.txt &&
32 diff -u expected.txt output.txt
34 rm -f foo
36 cat > expected.txt <<EOF
37 EOF
38 test_expect_success 'Status with an empty directory' '
39 mkdir foo &&
40 stg status > output.txt &&
41 diff -u expected.txt output.txt
44 cat > expected.txt <<EOF
45 ? foo/
46 EOF
47 test_expect_success 'Status with an untracked file in a subdir' '
48 touch foo/bar &&
49 stg status > output.txt &&
50 diff -u expected.txt output.txt
53 cat > expected.txt <<EOF
54 A foo/bar
55 EOF
56 test_expect_success 'Status with an added file' '
57 stg add foo &&
58 stg status > output.txt &&
59 diff -u expected.txt output.txt
62 cat > expected.txt <<EOF
63 foo/bar
64 EOF
65 test_expect_success 'Status with an added file and -n option' '
66 stg status -n > output.txt &&
67 diff -u expected.txt output.txt
70 cat > expected.txt <<EOF
71 EOF
72 test_expect_success 'Status after refresh' '
73 stg new -m "first patch" &&
74 stg refresh &&
75 stg status > output.txt &&
76 diff -u expected.txt output.txt
79 cat > expected.txt <<EOF
80 M foo/bar
81 EOF
82 test_expect_success 'Status after modification' '
83 echo "wee" >> foo/bar &&
84 stg status > output.txt &&
85 diff -u expected.txt output.txt
88 cat > expected.txt <<EOF
89 EOF
90 test_expect_success 'Status after refresh' '
91 stg new -m "second patch" && stg refresh &&
92 stg status > output.txt &&
93 diff -u expected.txt output.txt
96 test_expect_success 'Add another file' '
97 echo lajbans > fie &&
98 stg add fie &&
99 stg refresh
102 test_expect_success 'Make a conflicting patch' '
103 stg pop &&
104 stg new -m "third patch" &&
105 echo "woo" >> foo/bar &&
106 stg refresh
109 cat > expected.txt <<EOF
110 ? foo/bar.ancestor
111 ? foo/bar.current
112 ? foo/bar.patched
113 C foo/bar
115 test_expect_success 'Status after conflicting push' '
116 ! stg push &&
117 stg status > output.txt &&
118 diff -u expected.txt output.txt
121 cat > expected.txt <<EOF
122 C foo/bar
124 test_expect_success 'Status of file' '
125 stg status foo/bar > output.txt &&
126 diff -u expected.txt output.txt
129 cat > expected.txt <<EOF
131 test_expect_success 'Status of dir' '
132 stg status foo > output.txt &&
133 diff -u expected.txt output.txt
136 cat > expected.txt <<EOF
138 test_expect_success 'Status of other file' '
139 stg status fie > output.txt &&
140 diff -u expected.txt output.txt
143 cat > expected.txt <<EOF
144 M foo/bar
146 test_expect_success 'Status after resolving the push' '
147 stg resolved -a &&
148 stg status > output.txt &&
149 diff -u expected.txt output.txt
152 cat > expected.txt <<EOF
153 D foo/bar
155 test_expect_success 'Status after deleting a file' '
156 rm foo/bar &&
157 stg status > output.txt &&
158 diff -u expected.txt output.txt
161 test_done