tg.sh: handle help -h
[topgit/pro.git] / t / t1050-status.sh
blobf2c1f400ebbaf747a8dcdabc336cb05212b936e6
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 test_asv_cache '
13 master sha1 0665c39
14 master sha256 6b313f8
16 test_v_asv mastr7 master
18 unborn='HEAD -> master [unborn]
19 working directory is clean'
21 bareub='HEAD -> master [unborn]'
23 born="HEAD -> master [$mastr7]
24 working directory is clean"
26 bare="HEAD -> master [$mastr7]"
28 headborn="HEAD -> master [$mastr7]
30 allfixed='
31 all conflicts fixed; run "git commit" to record result'
33 unignored="; non-ignored, untracked files present"
35 moof="; currently updating branch 'moof'"
37 resultof='
38 You are currently updating as a result of:
41 lf='
44 updatecmds='
45 (use "tg update --continue" to continue)
46 (use "tg update --skip" to skip this branch and continue)
47 (use "tg update --stop" to stop and retain changes so far)
48 (use "tg update --abort" to restore pre-update state)'
50 workclean='
51 working directory is clean'
54 test_expect_success 'tg status unborn' '
55 test "$unborn" = "$(tg status)"
57 test_expect_success 'tg status unborn (bare)' '
58 test "$bareub" = "$(tg -C .git -c core.bare=true status 2>&1)"
61 test_expect_success 'tg status unborn untracked' '
62 >not-ignored &&
63 test "$unborn$unignored" = "$(tg status)" &&
64 rm not-ignored
67 test_tick || die
69 test_expect_success LASTOK 'tg status born' '
70 test_commit --notick initial &&
71 test "$born" = "$(tg status)"
74 test_expect_success LASTOK 'tg status born (bare)' '
75 test "$bare" = "$(tg -C .git -c core.bare=true status 2>&1)"
78 test_expect_success 'tg status born untracked' '
79 >not-ignored &&
80 test "$born$unignored" = "$(tg status)" &&
81 rm not-ignored
84 test_expect_success LASTOK 'tg status merge' '
85 >.git/MERGE_HEAD &&
86 test "${headborn}git merge in progress$allfixed" = "$(tg status)" &&
87 rm -f .git/MERGE_HEAD
90 test_expect_success LASTOK 'tg status am' '
91 mkdir .git/rebase-apply &&
92 >.git/rebase-apply/applying &&
93 test "${headborn}git am in progress" = "$(tg status)" &&
94 rm -rf .git/rebase-apply
97 test_expect_success LASTOK 'tg status rebase apply' '
98 mkdir .git/rebase-apply &&
99 test "${headborn}git rebase in progress" = "$(tg status)" &&
100 rm -rf .git/rebase-apply
103 test_expect_success LASTOK 'tg status rebase merge' '
104 mkdir .git/rebase-merge &&
105 test "${headborn}git rebase in progress" = "$(tg status)" &&
106 rm -rf .git/rebase-merge
109 test_expect_success LASTOK 'tg status cherry-pick' '
110 >.git/CHERRY_PICK_HEAD &&
111 test "${headborn}git cherry-pick in progress" = "$(tg status)" &&
112 rm -f .git/CHERRY_PICK_HEAD
115 test_expect_success LASTOK 'tg status bisect' '
116 >.git/BISECT_LOG &&
117 test "${headborn}git bisect in progress" = "$(tg status)" &&
118 rm -f .git/BISECT_LOG
121 test_expect_success LASTOK 'tg status revert' '
122 >.git/REVERT_HEAD &&
123 test "${headborn}git revert in progress" = "$(tg status)" &&
124 rm -f .git/REVERT_HEAD
127 test_expect_success LASTOK 'tg status update' '
128 mkdir .git/tg-state &&
129 >.git/tg-state/name &&
130 echo update >.git/tg-state/state &&
131 test "${headborn}tg update in progress$updatecmds$workclean" = "$(tg status)" &&
132 rm -rf .git/tg-state
135 test_expect_success LASTOK 'tg status update moof' '
136 mkdir .git/tg-state &&
137 echo moof >.git/tg-state/name &&
138 echo update >.git/tg-state/state &&
139 test "${headborn}tg update in progress$moof$updatecmds$workclean" = "$(tg status)" &&
140 rm -rf .git/tg-state
143 test_expect_success LASTOK 'tg status update moofing moof' '
144 mkdir .git/tg-state &&
145 echo moof >.git/tg-state/name &&
146 echo moof >.git/tg-state/names &&
147 echo update >.git/tg-state/state &&
148 echo "moofing moof" > .git/tg-state/fullcmd &&
149 test "${headborn}tg update in progress$moof${resultof}moofing moof$updatecmds$workclean" = "$(tg status)" &&
150 rm -rf .git/tg-state
153 test_expect_success LASTOK 'tg status update moofing moof woof' '
154 mkdir .git/tg-state &&
155 echo moof >.git/tg-state/name &&
156 echo moof woof >.git/tg-state/names &&
157 echo moof >.git/tg-state/processed &&
158 echo update >.git/tg-state/state &&
159 echo "moofing moof" > .git/tg-state/fullcmd &&
160 test "${headborn}tg update in progress$moof${resultof}moofing moof${lf}1 of 2 branches updated so far$updatecmds$workclean" = "$(tg status)" &&
161 rm -rf .git/tg-state
164 test_done