3 dc5351b4 2019-07-30 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 dc5351b4 2019-07-30 stsp # Permission to use, copy, modify, and distribute this software for any
6 dc5351b4 2019-07-30 stsp # purpose with or without fee is hereby granted, provided that the above
7 dc5351b4 2019-07-30 stsp # copyright notice and this permission notice appear in all copies.
9 dc5351b4 2019-07-30 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 dc5351b4 2019-07-30 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 dc5351b4 2019-07-30 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 dc5351b4 2019-07-30 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 dc5351b4 2019-07-30 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 dc5351b4 2019-07-30 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 dc5351b4 2019-07-30 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 dc5351b4 2019-07-30 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_branch_create() {
20 dc5351b4 2019-07-30 stsp local testroot=`test_init branch_create`
21 da76fce2 2020-02-24 stsp local commit_id0=`git_show_head $testroot/repo`
23 dc5351b4 2019-07-30 stsp # Create a branch based on repository's HEAD reference
24 dc5351b4 2019-07-30 stsp got branch -r $testroot/repo newbranch
26 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
27 dc5351b4 2019-07-30 stsp echo "got branch command failed unexpectedly"
28 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
32 dc5351b4 2019-07-30 stsp # Ensure that Git recognizes the branch Got has created
33 dc5351b4 2019-07-30 stsp (cd $testroot/repo && git checkout -q newbranch)
35 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
36 dc5351b4 2019-07-30 stsp echo "git checkout command failed unexpectedly"
37 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
40 dc5351b4 2019-07-30 stsp echo "modified delta on branch" > $testroot/repo/gamma/delta
41 dc5351b4 2019-07-30 stsp git_commit $testroot/repo -m "committing to delta on newbranch"
43 dc5351b4 2019-07-30 stsp got checkout -b newbranch $testroot/repo $testroot/wt >/dev/null
45 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
46 dc5351b4 2019-07-30 stsp echo "got checkout command failed unexpectedly"
47 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
51 dc5351b4 2019-07-30 stsp echo "modified delta on branch" > $testroot/content.expected
52 dc5351b4 2019-07-30 stsp cat $testroot/wt/gamma/delta > $testroot/content
53 dc5351b4 2019-07-30 stsp cmp -s $testroot/content.expected $testroot/content
55 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
56 dc5351b4 2019-07-30 stsp diff -u $testroot/content.expected $testroot/content
57 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
61 dc5351b4 2019-07-30 stsp # Create a branch based on the work tree's branch
62 2f1457c6 2021-08-27 stsp (cd $testroot/wt && got branch -n refs/heads/anotherbranch)
64 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
65 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
69 dc5351b4 2019-07-30 stsp (cd $testroot/repo && git checkout -q anotherbranch)
71 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
72 dc5351b4 2019-07-30 stsp echo "git checkout command failed unexpectedly"
73 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
77 dc5351b4 2019-07-30 stsp # Create a branch based on another specific branch
78 da76fce2 2020-02-24 stsp (cd $testroot/wt && got branch -n -c master yetanotherbranch)
80 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
81 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
85 dc5351b4 2019-07-30 stsp (cd $testroot/repo && git checkout -q yetanotherbranch)
87 a4f89d48 2019-08-25 stsp if [ "$ret" != "0" ]; then
88 a4f89d48 2019-08-25 stsp echo "git checkout command failed unexpectedly"
89 a4f89d48 2019-08-25 stsp test_done "$testroot" "$ret"
93 a4f89d48 2019-08-25 stsp # Create a branch based on a specific commit
94 a4f89d48 2019-08-25 stsp local commit_id=`git_show_head $testroot/repo`
95 a74f7e83 2019-11-10 stsp got branch -r $testroot/repo -c $commit_id commitbranch
97 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
98 a4f89d48 2019-08-25 stsp echo "got branch command failed unexpectedly"
99 a4f89d48 2019-08-25 stsp test_done "$testroot" "$ret"
103 a4f89d48 2019-08-25 stsp (cd $testroot/repo && git checkout -q commitbranch)
105 a4f89d48 2019-08-25 stsp if [ "$ret" != "0" ]; then
106 dc5351b4 2019-07-30 stsp echo "git checkout command failed unexpectedly"
107 da76fce2 2020-02-24 stsp test_done "$testroot" "$ret"
111 da76fce2 2020-02-24 stsp # Create a branch and let the work tree be updated to it
112 da76fce2 2020-02-24 stsp (cd $testroot/wt && got branch -c $commit_id0 updatebranch \
113 da76fce2 2020-02-24 stsp > $testroot/stdout)
115 da76fce2 2020-02-24 stsp echo -n "Switching work tree from refs/heads/newbranch to " \
116 da76fce2 2020-02-24 stsp > $testroot/stdout.expected
117 da76fce2 2020-02-24 stsp echo "refs/heads/updatebranch" >> $testroot/stdout.expected
118 da76fce2 2020-02-24 stsp echo "U gamma/delta" >> $testroot/stdout.expected
119 da76fce2 2020-02-24 stsp echo "Updated to commit $commit_id0" >> $testroot/stdout.expected
121 da76fce2 2020-02-24 stsp cmp -s $testroot/stdout.expected $testroot/stdout
123 da76fce2 2020-02-24 stsp if [ "$ret" != "0" ]; then
124 da76fce2 2020-02-24 stsp diff -u $testroot/stdout.expected $testroot/stdout
126 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
129 f6cae3ed 2020-09-13 naddy test_branch_list() {
130 dc5351b4 2019-07-30 stsp local testroot=`test_init branch_list`
131 dc5351b4 2019-07-30 stsp local commit_id=`git_show_head $testroot/repo`
133 dc5351b4 2019-07-30 stsp for b in branch1 branch2 branch3; do
134 dc5351b4 2019-07-30 stsp got branch -r $testroot/repo $b
136 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
137 dc5351b4 2019-07-30 stsp echo "got branch command failed unexpectedly"
138 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
143 dc5351b4 2019-07-30 stsp got branch -l -r $testroot/repo > $testroot/stdout
144 dc5351b4 2019-07-30 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
145 dc5351b4 2019-07-30 stsp echo " branch2: $commit_id" >> $testroot/stdout.expected
146 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
147 dc5351b4 2019-07-30 stsp echo " master: $commit_id" >> $testroot/stdout.expected
148 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
150 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
151 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
152 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
156 dc5351b4 2019-07-30 stsp got checkout $testroot/repo $testroot/wt >/dev/null
158 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
159 dc5351b4 2019-07-30 stsp echo "got checkout command failed unexpectedly"
160 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
164 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got branch -l > $testroot/stdout)
165 dc5351b4 2019-07-30 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
166 dc5351b4 2019-07-30 stsp echo " branch2: $commit_id" >> $testroot/stdout.expected
167 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
168 dc5351b4 2019-07-30 stsp echo "* master: $commit_id" >> $testroot/stdout.expected
169 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
171 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
172 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
173 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
177 dc5351b4 2019-07-30 stsp echo "modified delta" > $testroot/repo/gamma/delta
178 dc5351b4 2019-07-30 stsp git_commit $testroot/repo -m "committing to delta"
179 dc5351b4 2019-07-30 stsp local commit_id2=`git_show_head $testroot/repo`
181 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got branch -l > $testroot/stdout)
182 dc5351b4 2019-07-30 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
183 dc5351b4 2019-07-30 stsp echo " branch2: $commit_id" >> $testroot/stdout.expected
184 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
185 dc5351b4 2019-07-30 stsp echo "~ master: $commit_id2" >> $testroot/stdout.expected
186 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
188 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
189 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
190 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
194 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got update > /dev/null)
196 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
197 dc5351b4 2019-07-30 stsp echo "got update command failed unexpectedly"
198 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
202 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got branch -l > $testroot/stdout)
203 dc5351b4 2019-07-30 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
204 dc5351b4 2019-07-30 stsp echo " branch2: $commit_id" >> $testroot/stdout.expected
205 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
206 dc5351b4 2019-07-30 stsp echo "* master: $commit_id2" >> $testroot/stdout.expected
207 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
209 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
210 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
211 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
215 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got update -b branch1 > /dev/null)
217 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
218 dc5351b4 2019-07-30 stsp echo "got update command failed unexpectedly"
219 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
223 dc5351b4 2019-07-30 stsp (cd $testroot/wt && got branch -l > $testroot/stdout)
224 dc5351b4 2019-07-30 stsp echo "* branch1: $commit_id" > $testroot/stdout.expected
225 dc5351b4 2019-07-30 stsp echo " branch2: $commit_id" >> $testroot/stdout.expected
226 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
227 dc5351b4 2019-07-30 stsp echo " master: $commit_id2" >> $testroot/stdout.expected
228 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
230 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
231 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
233 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
236 f6cae3ed 2020-09-13 naddy test_branch_delete() {
237 dc5351b4 2019-07-30 stsp local testroot=`test_init branch_delete`
238 dc5351b4 2019-07-30 stsp local commit_id=`git_show_head $testroot/repo`
240 dc5351b4 2019-07-30 stsp for b in branch1 branch2 branch3; do
241 dc5351b4 2019-07-30 stsp got branch -r $testroot/repo $b
243 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
244 dc5351b4 2019-07-30 stsp echo "got branch command failed unexpectedly"
245 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
250 dc5351b4 2019-07-30 stsp got branch -d branch2 -r $testroot/repo > $testroot/stdout
252 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
253 2f1457c6 2021-08-27 stsp echo "got branch command failed unexpectedly"
254 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
258 dc5351b4 2019-07-30 stsp got branch -l -r $testroot/repo > $testroot/stdout
259 dc5351b4 2019-07-30 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
260 dc5351b4 2019-07-30 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
261 dc5351b4 2019-07-30 stsp echo " master: $commit_id" >> $testroot/stdout.expected
262 6aeab596 2019-08-28 stsp cmp -s $testroot/stdout $testroot/stdout.expected
264 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
265 6aeab596 2019-08-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
266 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
270 6aeab596 2019-08-28 stsp got ref -l -r $testroot/repo > $testroot/stdout
271 6aeab596 2019-08-28 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
272 6aeab596 2019-08-28 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
273 6aeab596 2019-08-28 stsp echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
274 6aeab596 2019-08-28 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
275 dc5351b4 2019-07-30 stsp cmp -s $testroot/stdout $testroot/stdout.expected
277 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
278 dc5351b4 2019-07-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
279 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
283 dc5351b4 2019-07-30 stsp got branch -d bogus_branch_name -r $testroot/repo \
284 dc5351b4 2019-07-30 stsp > $testroot/stdout 2> $testroot/stderr
286 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
287 2f1457c6 2021-08-27 stsp echo "got branch succeeded unexpectedly"
288 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
292 dc5351b4 2019-07-30 stsp echo "got: reference refs/heads/bogus_branch_name not found" \
293 dc5351b4 2019-07-30 stsp > $testroot/stderr.expected
294 dc5351b4 2019-07-30 stsp cmp -s $testroot/stderr $testroot/stderr.expected
296 dc5351b4 2019-07-30 stsp if [ "$ret" != "0" ]; then
297 dc5351b4 2019-07-30 stsp diff -u $testroot/stderr.expected $testroot/stderr
298 2f1457c6 2021-08-27 stsp test_done "$testroot" "$ret"
302 2f1457c6 2021-08-27 stsp got ref -r $testroot/repo -c master refs/remotes/origin/master
303 2f1457c6 2021-08-27 stsp got ref -r $testroot/repo -c branch1 refs/remotes/origin/branch1
304 2f1457c6 2021-08-27 stsp got ref -r $testroot/repo -c branch3 refs/remotes/origin/branch3
306 2f1457c6 2021-08-27 stsp got ref -l -r $testroot/repo > $testroot/stdout
307 2f1457c6 2021-08-27 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
308 2f1457c6 2021-08-27 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
309 2f1457c6 2021-08-27 stsp echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
310 2f1457c6 2021-08-27 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
311 2f1457c6 2021-08-27 stsp echo "refs/remotes/origin/branch1: $commit_id" \
312 2f1457c6 2021-08-27 stsp >> $testroot/stdout.expected
313 2f1457c6 2021-08-27 stsp echo "refs/remotes/origin/branch3: $commit_id" \
314 2f1457c6 2021-08-27 stsp >> $testroot/stdout.expected
315 2f1457c6 2021-08-27 stsp echo "refs/remotes/origin/master: $commit_id" \
316 2f1457c6 2021-08-27 stsp >> $testroot/stdout.expected
317 2f1457c6 2021-08-27 stsp cmp -s $testroot/stdout $testroot/stdout.expected
319 2f1457c6 2021-08-27 stsp if [ "$ret" != "0" ]; then
320 2f1457c6 2021-08-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
321 2f1457c6 2021-08-27 stsp test_done "$testroot" "$ret"
325 2f1457c6 2021-08-27 stsp got branch -d origin/branch1 -r $testroot/repo > $testroot/stdout
327 2f1457c6 2021-08-27 stsp if [ "$ret" != "0" ]; then
328 2f1457c6 2021-08-27 stsp echo "got branch command failed unexpectedly"
329 2f1457c6 2021-08-27 stsp test_done "$testroot" "$ret"
333 2f1457c6 2021-08-27 stsp got branch -d refs/remotes/origin/branch3 -r $testroot/repo \
334 2f1457c6 2021-08-27 stsp > $testroot/stdout
336 2f1457c6 2021-08-27 stsp if [ "$ret" != "0" ]; then
337 2f1457c6 2021-08-27 stsp echo "got branch command failed unexpectedly"
338 2f1457c6 2021-08-27 stsp test_done "$testroot" "$ret"
342 2f1457c6 2021-08-27 stsp got ref -l -r $testroot/repo > $testroot/stdout
343 2f1457c6 2021-08-27 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
344 2f1457c6 2021-08-27 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
345 2f1457c6 2021-08-27 stsp echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
346 2f1457c6 2021-08-27 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
347 2f1457c6 2021-08-27 stsp echo "refs/remotes/origin/master: $commit_id" \
348 2f1457c6 2021-08-27 stsp >> $testroot/stdout.expected
349 2f1457c6 2021-08-27 stsp cmp -s $testroot/stdout $testroot/stdout.expected
351 2f1457c6 2021-08-27 stsp if [ "$ret" != "0" ]; then
352 2f1457c6 2021-08-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
354 dc5351b4 2019-07-30 stsp test_done "$testroot" "$ret"
357 f6cae3ed 2020-09-13 naddy test_branch_delete_current_branch() {
358 45cd4e47 2019-08-25 stsp local testroot=`test_init branch_delete_current_branch`
359 45cd4e47 2019-08-25 stsp local commit_id=`git_show_head $testroot/repo`
361 45cd4e47 2019-08-25 stsp got checkout $testroot/repo $testroot/wt >/dev/null
363 45cd4e47 2019-08-25 stsp if [ "$ret" != "0" ]; then
364 45cd4e47 2019-08-25 stsp echo "got checkout command failed unexpectedly"
365 45cd4e47 2019-08-25 stsp test_done "$testroot" "$ret"
369 45cd4e47 2019-08-25 stsp (cd $testroot/wt && got branch -d master > $testroot/stdout \
370 45cd4e47 2019-08-25 stsp 2> $testroot/stderr)
372 45cd4e47 2019-08-25 stsp echo "got: will not delete this work tree's current branch" \
373 6aeab596 2019-08-28 stsp > $testroot/stderr.expected
374 6aeab596 2019-08-28 stsp cmp -s $testroot/stderr $testroot/stderr.expected
376 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
377 6aeab596 2019-08-28 stsp diff -u $testroot/stderr.expected $testroot/stderr
379 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
382 f6cae3ed 2020-09-13 naddy test_branch_delete_packed() {
383 6aeab596 2019-08-28 stsp local testroot=`test_init branch_delete_packed`
384 6aeab596 2019-08-28 stsp local commit_id=`git_show_head $testroot/repo`
386 6aeab596 2019-08-28 stsp for b in branch1 branch2 branch3; do
387 6aeab596 2019-08-28 stsp got branch -r $testroot/repo $b
389 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
390 6aeab596 2019-08-28 stsp echo "got branch command failed unexpectedly"
391 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
396 6aeab596 2019-08-28 stsp (cd $testroot/repo && git pack-refs --all)
398 2f1457c6 2021-08-27 stsp got branch -d refs/heads/branch2 -r $testroot/repo > $testroot/stdout
400 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
401 6aeab596 2019-08-28 stsp echo "got update command failed unexpectedly"
402 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
406 6aeab596 2019-08-28 stsp got branch -l -r $testroot/repo > $testroot/stdout
407 6aeab596 2019-08-28 stsp echo " branch1: $commit_id" > $testroot/stdout.expected
408 6aeab596 2019-08-28 stsp echo " branch3: $commit_id" >> $testroot/stdout.expected
409 6aeab596 2019-08-28 stsp echo " master: $commit_id" >> $testroot/stdout.expected
410 6aeab596 2019-08-28 stsp cmp -s $testroot/stdout $testroot/stdout.expected
412 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
413 6aeab596 2019-08-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
414 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
418 6aeab596 2019-08-28 stsp got ref -l -r $testroot/repo > $testroot/stdout
419 6aeab596 2019-08-28 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
420 6aeab596 2019-08-28 stsp echo "refs/heads/branch1: $commit_id" >> $testroot/stdout.expected
421 6aeab596 2019-08-28 stsp echo "refs/heads/branch3: $commit_id" >> $testroot/stdout.expected
422 6aeab596 2019-08-28 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
423 6aeab596 2019-08-28 stsp cmp -s $testroot/stdout $testroot/stdout.expected
425 6aeab596 2019-08-28 stsp if [ "$ret" != "0" ]; then
426 6aeab596 2019-08-28 stsp diff -u $testroot/stdout.expected $testroot/stdout
427 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
431 6aeab596 2019-08-28 stsp got branch -d bogus_branch_name -r $testroot/repo \
432 6aeab596 2019-08-28 stsp > $testroot/stdout 2> $testroot/stderr
434 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
435 6aeab596 2019-08-28 stsp echo "got update succeeded unexpectedly"
436 6aeab596 2019-08-28 stsp test_done "$testroot" "$ret"
440 6aeab596 2019-08-28 stsp echo "got: reference refs/heads/bogus_branch_name not found" \
441 45cd4e47 2019-08-25 stsp > $testroot/stderr.expected
442 45cd4e47 2019-08-25 stsp cmp -s $testroot/stderr $testroot/stderr.expected
444 45cd4e47 2019-08-25 stsp if [ "$ret" != "0" ]; then
445 45cd4e47 2019-08-25 stsp diff -u $testroot/stderr.expected $testroot/stderr
447 ad89fa31 2019-10-04 stsp test_done "$testroot" "$ret"
450 f6cae3ed 2020-09-13 naddy test_branch_show() {
451 ad89fa31 2019-10-04 stsp local testroot=`test_init branch_show`
452 ad89fa31 2019-10-04 stsp local commit_id=`git_show_head $testroot/repo`
454 ad89fa31 2019-10-04 stsp for b in branch1 branch2 branch3; do
455 ad89fa31 2019-10-04 stsp got branch -r $testroot/repo $b
457 ad89fa31 2019-10-04 stsp if [ "$ret" != "0" ]; then
458 ad89fa31 2019-10-04 stsp echo "got branch command failed unexpectedly"
459 ad89fa31 2019-10-04 stsp test_done "$testroot" "$ret"
464 ad89fa31 2019-10-04 stsp got checkout $testroot/repo $testroot/wt >/dev/null
466 ad89fa31 2019-10-04 stsp if [ "$ret" != "0" ]; then
467 ad89fa31 2019-10-04 stsp echo "got checkout command failed unexpectedly"
468 ad89fa31 2019-10-04 stsp test_done "$testroot" "$ret"
472 ad89fa31 2019-10-04 stsp (cd $testroot/wt && got branch > $testroot/stdout)
473 ad89fa31 2019-10-04 stsp echo "master" > $testroot/stdout.expected
474 ad89fa31 2019-10-04 stsp cmp -s $testroot/stdout $testroot/stdout.expected
476 ad89fa31 2019-10-04 stsp if [ "$ret" != "0" ]; then
477 ad89fa31 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
478 ad89fa31 2019-10-04 stsp test_done "$testroot" "$ret"
482 ad89fa31 2019-10-04 stsp (cd $testroot/wt && got update -b branch1 > /dev/null)
484 ad89fa31 2019-10-04 stsp if [ "$ret" != "0" ]; then
485 ad89fa31 2019-10-04 stsp echo "got update command failed unexpectedly"
486 ad89fa31 2019-10-04 stsp test_done "$testroot" "$ret"
490 ad89fa31 2019-10-04 stsp (cd $testroot/wt && got branch > $testroot/stdout)
491 ad89fa31 2019-10-04 stsp echo "branch1" > $testroot/stdout.expected
492 ad89fa31 2019-10-04 stsp cmp -s $testroot/stdout $testroot/stdout.expected
494 ad89fa31 2019-10-04 stsp if [ "$ret" != "0" ]; then
495 ad89fa31 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
497 45cd4e47 2019-08-25 stsp test_done "$testroot" "$ret"
501 7fb414ae 2020-08-08 stsp test_parseargs "$@"
502 dc5351b4 2019-07-30 stsp run_test test_branch_create
503 dc5351b4 2019-07-30 stsp run_test test_branch_list
504 dc5351b4 2019-07-30 stsp run_test test_branch_delete
505 45cd4e47 2019-08-25 stsp run_test test_branch_delete_current_branch
506 6aeab596 2019-08-28 stsp run_test test_branch_delete_packed
507 ad89fa31 2019-10-04 stsp run_test test_branch_show