tg-patch.sh: get all awked up on --from
[topgit/pro.git] / t / t1050-status.sh
blob41e3393aa41e3cd6aecfb0b95cec991f8a51cab4
1 #!/bin/sh
3 test_description='tg status
5 Make sure tg status detects everything it should.
8 . ./test-lib.sh
10 test_plan 17
12 unborn='HEAD -> master [unborn]
13 working directory is clean'
15 bareub='HEAD -> master [unborn]'
17 born='HEAD -> master [7cfc564]
18 working directory is clean'
20 bare='HEAD -> master [7cfc564]'
22 headborn='HEAD -> master [7cfc564]
24 allfixed='
25 all conflicts fixed; run "git commit" to record result'
27 unignored="; non-ignored, untracked files present"
29 moof="; currently updating branch 'moof'"
31 resultof='
32 You are currently updating as a result of:
35 lf='
38 updatecmds='
39 (use "tg update --continue" to continue)
40 (use "tg update --skip" to skip this branch and continue)
41 (use "tg update --stop" to stop and retain changes so far)
42 (use "tg update --abort" to restore pre-update state)'
44 workclean='
45 working directory is clean'
48 test_expect_success 'tg status unborn' '
49 test "$unborn" = "$(tg status)"
51 test_expect_success 'tg status unborn (bare)' '
52 test "$bareub" = "$(tg -C .git -c core.bare=true status 2>&1)"
55 test_expect_success 'tg status unborn untracked' '
56 >not-ignored &&
57 test "$unborn$unignored" = "$(tg status)" &&
58 rm not-ignored
61 test_tick || die
63 test_expect_success LASTOK 'tg status born' '
64 test_commit --notick initial &&
65 test "$born" = "$(tg status)"
68 test_expect_success LASTOK 'tg status born (bare)' '
69 test "$bare" = "$(tg -C .git -c core.bare=true status 2>&1)"
72 test_expect_success 'tg status born untracked' '
73 >not-ignored &&
74 test "$born$unignored" = "$(tg status)" &&
75 rm not-ignored
78 test_expect_success LASTOK 'tg status merge' '
79 >.git/MERGE_HEAD &&
80 test "${headborn}git merge in progress$allfixed" = "$(tg status)" &&
81 rm -f .git/MERGE_HEAD
84 test_expect_success LASTOK 'tg status am' '
85 mkdir .git/rebase-apply &&
86 >.git/rebase-apply/applying &&
87 test "${headborn}git am in progress" = "$(tg status)" &&
88 rm -rf .git/rebase-apply
91 test_expect_success LASTOK 'tg status rebase apply' '
92 mkdir .git/rebase-apply &&
93 test "${headborn}git rebase in progress" = "$(tg status)" &&
94 rm -rf .git/rebase-apply
97 test_expect_success LASTOK 'tg status rebase merge' '
98 mkdir .git/rebase-merge &&
99 test "${headborn}git rebase in progress" = "$(tg status)" &&
100 rm -rf .git/rebase-merge
103 test_expect_success LASTOK 'tg status cherry-pick' '
104 >.git/CHERRY_PICK_HEAD &&
105 test "${headborn}git cherry-pick in progress" = "$(tg status)" &&
106 rm -f .git/CHERRY_PICK_HEAD
109 test_expect_success LASTOK 'tg status bisect' '
110 >.git/BISECT_LOG &&
111 test "${headborn}git bisect in progress" = "$(tg status)" &&
112 rm -f .git/BISECT_LOG
115 test_expect_success LASTOK 'tg status revert' '
116 >.git/REVERT_HEAD &&
117 test "${headborn}git revert in progress" = "$(tg status)" &&
118 rm -f .git/REVERT_HEAD
121 test_expect_success LASTOK 'tg status update' '
122 mkdir .git/tg-update &&
123 >.git/tg-update/name &&
124 test "${headborn}tg update in progress$updatecmds$workclean" = "$(tg status)" &&
125 rm -rf .git/tg-update
128 test_expect_success LASTOK 'tg status update moof' '
129 mkdir .git/tg-update &&
130 echo moof >.git/tg-update/name &&
131 test "${headborn}tg update in progress$moof$updatecmds$workclean" = "$(tg status)" &&
132 rm -rf .git/tg-update
135 test_expect_success LASTOK 'tg status update moofing moof' '
136 mkdir .git/tg-update &&
137 echo moof >.git/tg-update/name &&
138 echo moof >.git/tg-update/names &&
139 echo "moofing moof" > .git/tg-update/fullcmd &&
140 test "${headborn}tg update in progress$moof${resultof}moofing moof$updatecmds$workclean" = "$(tg status)" &&
141 rm -rf .git/tg-update
144 test_expect_success LASTOK 'tg status update moofing moof woof' '
145 mkdir .git/tg-update &&
146 echo moof >.git/tg-update/name &&
147 echo moof woof >.git/tg-update/names &&
148 echo moof >.git/tg-update/processed &&
149 echo "moofing moof" > .git/tg-update/fullcmd &&
150 test "${headborn}tg update in progress$moof${resultof}moofing moof${lf}1 of 2 branches updated so far$updatecmds$workclean" = "$(tg status)" &&
151 rm -rf .git/tg-update
154 test_done