1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
#!/bin/sh
#
# Copyright (c) 2007 David Kgedal
#
test_description='Basic stg status
Test that "stg status" works.'
. ./test-lib.sh
stg init
# Ignore our own output files.
cat >> .git/info/exclude <<EOF
/expected.txt
/output.txt
EOF
cat > expected.txt <<EOF
EOF
test_expect_success 'Run status on empty' '
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
?? foo
EOF
test_expect_success 'Status with an untracked file' '
touch foo &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
rm -f foo
cat > expected.txt <<EOF
EOF
test_expect_success 'Status with an empty directory' '
mkdir foo &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
?? foo/
EOF
test_expect_success 'Status with an untracked file in a subdir' '
touch foo/bar &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
A foo/bar
EOF
test_expect_success 'Status with an added file' '
stg add foo &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
EOF
test_expect_success 'Status after refresh' '
stg new -m "first patch" &&
stg refresh &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
M foo/bar
EOF
test_expect_success 'Status after modification' '
echo "wee" >> foo/bar &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
EOF
test_expect_success 'Status after refresh' '
stg new -m "second patch" && stg refresh &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
test_expect_success 'Add another file' '
echo lajbans > fie &&
stg add fie &&
stg refresh
'
test_expect_success 'Make a conflicting patch' '
stg pop &&
stg new -m "third patch" &&
echo "woo" >> foo/bar &&
stg refresh
'
cat > expected.txt <<EOF
A fie
UU foo/bar
EOF
test_expect_success 'Status after conflicting push' '
conflict stg push &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
UU foo/bar
EOF
test_expect_success 'Status of file' '
stg status foo/bar > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
UU foo/bar
EOF
test_expect_success 'Status of dir' '
stg status foo > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
A fie
EOF
test_expect_success 'Status of other file' '
stg status fie > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
A fie
M foo/bar
EOF
test_expect_success 'Status after resolving the push' '
stg add --update &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
A fie
MD foo/bar
EOF
test_expect_success 'Status after deleting a file' '
rm foo/bar &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
AD foo/bar
EOF
test_expect_success 'Status of disappeared newborn' '
stg refresh --force &&
touch foo/bar &&
stg add foo/bar &&
rm foo/bar &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
cat > expected.txt <<EOF
R fie -> fay
EOF
test_expect_success 'Status after renaming a file' '
stg rm foo/bar &&
stg mv fie fay &&
stg status > output.txt &&
test_cmp expected.txt output.txt
'
test_done
|