3 # Copyright (c) 2019, 2020 Stefan Sperling <stsp@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 local testroot=`test_init rebase_basic`
21 local commit0=`git_show_head $testroot/repo`
22 local commit0_author_time=`git_show_author_time $testroot/repo`
24 (cd $testroot/repo && git checkout -q -b newbranch)
25 echo "modified delta on branch" > $testroot/repo/gamma/delta
26 git_commit $testroot/repo -m "committing to delta on newbranch"
28 echo "modified alpha on branch" > $testroot/repo/alpha
29 (cd $testroot/repo && git rm -q beta)
30 echo "new file on branch" > $testroot/repo/epsilon/new
31 (cd $testroot/repo && git add epsilon/new)
32 git_commit $testroot/repo -m "committing more changes on newbranch"
34 local orig_commit1=`git_show_parent_commit $testroot/repo`
35 local orig_commit2=`git_show_head $testroot/repo`
36 local orig_author_time2=`git_show_author_time $testroot/repo`
38 (cd $testroot/repo && git checkout -q master)
39 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
40 git_commit $testroot/repo -m "committing to zeta on master"
41 local master_commit=`git_show_head $testroot/repo`
43 got checkout $testroot/repo $testroot/wt > /dev/null
45 if [ $ret -ne 0 ]; then
46 test_done "$testroot" "$ret"
50 (cd $testroot/wt && got rebase newbranch > $testroot/stdout)
52 (cd $testroot/repo && git checkout -q newbranch)
53 local new_commit1=`git_show_parent_commit $testroot/repo`
54 local new_commit2=`git_show_head $testroot/repo`
55 local new_author_time2=`git_show_author_time $testroot/repo`
57 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
58 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
59 local short_new_commit1=`trim_obj_id 28 $new_commit1`
60 local short_new_commit2=`trim_obj_id 28 $new_commit2`
62 echo "G gamma/delta" >> $testroot/stdout.expected
63 echo -n "$short_orig_commit1 -> $short_new_commit1" \
64 >> $testroot/stdout.expected
65 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
66 echo "G alpha" >> $testroot/stdout.expected
67 echo "D beta" >> $testroot/stdout.expected
68 echo "A epsilon/new" >> $testroot/stdout.expected
69 echo -n "$short_orig_commit2 -> $short_new_commit2" \
70 >> $testroot/stdout.expected
71 echo ": committing more changes on newbranch" \
72 >> $testroot/stdout.expected
73 echo "Switching work tree to refs/heads/newbranch" \
74 >> $testroot/stdout.expected
76 cmp -s $testroot/stdout.expected $testroot/stdout
78 if [ $ret -ne 0 ]; then
79 diff -u $testroot/stdout.expected $testroot/stdout
80 test_done "$testroot" "$ret"
84 echo "modified delta on branch" > $testroot/content.expected
85 cat $testroot/wt/gamma/delta > $testroot/content
86 cmp -s $testroot/content.expected $testroot/content
88 if [ $ret -ne 0 ]; then
89 diff -u $testroot/content.expected $testroot/content
90 test_done "$testroot" "$ret"
94 echo "modified alpha on branch" > $testroot/content.expected
95 cat $testroot/wt/alpha > $testroot/content
96 cmp -s $testroot/content.expected $testroot/content
98 if [ $ret -ne 0 ]; then
99 diff -u $testroot/content.expected $testroot/content
100 test_done "$testroot" "$ret"
104 if [ -e $testroot/wt/beta ]; then
105 echo "removed file beta still exists on disk" >&2
106 test_done "$testroot" "1"
110 echo "new file on branch" > $testroot/content.expected
111 cat $testroot/wt/epsilon/new > $testroot/content
112 cmp -s $testroot/content.expected $testroot/content
114 if [ $ret -ne 0 ]; then
115 diff -u $testroot/content.expected $testroot/content
116 test_done "$testroot" "$ret"
120 (cd $testroot/wt && got status > $testroot/stdout)
122 echo -n > $testroot/stdout.expected
123 cmp -s $testroot/stdout.expected $testroot/stdout
125 if [ $ret -ne 0 ]; then
126 diff -u $testroot/stdout.expected $testroot/stdout
127 test_done "$testroot" "$ret"
131 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
132 echo "commit $new_commit2 (newbranch)" > $testroot/stdout.expected
133 echo "commit $new_commit1" >> $testroot/stdout.expected
134 echo "commit $master_commit (master)" >> $testroot/stdout.expected
135 cmp -s $testroot/stdout.expected $testroot/stdout
137 if [ $ret -ne 0 ]; then
138 diff -u $testroot/stdout.expected $testroot/stdout
139 test_done "$testroot" "$ret"
143 (cd $testroot/wt && got update > $testroot/stdout)
145 echo 'Already up-to-date' > $testroot/stdout.expected
146 cmp -s $testroot/stdout.expected $testroot/stdout
148 if [ $ret -ne 0 ]; then
149 diff -u $testroot/stdout.expected $testroot/stdout
150 test_done "$testroot" "$ret"
154 # We should have a backup of old commits
155 (cd $testroot/repo && got rebase -l > $testroot/stdout)
156 local prev_LC_TIME="$LC_TIME"
158 d_orig2=`date -u -d "@$orig_author_time2" +"%a %b %e %X %Y UTC"`
159 export LC_TIME="$prev_LC_TIME"
160 d_new2=`date -u -d "@$new_author_time2" +"%G-%m-%d"`
161 d_0=`date -u -d "@$commit0_author_time" +"%G-%m-%d"`
162 cat > $testroot/stdout.expected <<EOF
163 -----------------------------------------------
164 commit $orig_commit2 (formerly newbranch)
168 committing more changes on newbranch
170 has become commit $new_commit2 (newbranch)
171 $d_new2 $GOT_AUTHOR_11 committing more changes on newbranch
172 history forked at $commit0
173 $d_0 $GOT_AUTHOR_11 adding the test tree
175 cmp -s $testroot/stdout.expected $testroot/stdout
177 if [ $ret -ne 0 ]; then
178 diff -u $testroot/stdout.expected $testroot/stdout
179 test_done "$testroot" "$ret"
183 # Asking for backups of a branch which has none should yield an error
184 (cd $testroot/repo && got rebase -l master \
185 > $testroot/stdout 2> $testroot/stderr)
186 echo -n > $testroot/stdout.expected
187 echo "got: refs/got/backup/rebase/master/: no such reference found" \
188 > $testroot/stderr.expected
189 cmp -s $testroot/stdout.expected $testroot/stdout
191 if [ $ret -ne 0 ]; then
192 diff -u $testroot/stdout.expected $testroot/stdout
193 test_done "$testroot" "$ret"
196 cmp -s $testroot/stderr.expected $testroot/stderr
198 if [ $ret -ne 0 ]; then
199 diff -u $testroot/stderr.expected $testroot/stderr
200 test_done "$testroot" "$ret"
204 # Delete all backup refs
205 (cd $testroot/repo && got rebase -X \
206 > $testroot/stdout 2> $testroot/stderr)
207 echo -n "Deleted refs/got/backup/rebase/newbranch/$new_commit2: " \
208 > $testroot/stdout.expected
209 echo "$orig_commit2" >> $testroot/stdout.expected
210 echo -n > $testroot/stderr.expected
211 cmp -s $testroot/stdout.expected $testroot/stdout
213 if [ $ret -ne 0 ]; then
214 diff -u $testroot/stdout.expected $testroot/stdout
215 test_done "$testroot" "$ret"
218 cmp -s $testroot/stderr.expected $testroot/stderr
220 if [ $ret -ne 0 ]; then
221 diff -u $testroot/stderr.expected $testroot/stderr
222 test_done "$testroot" "$ret"
226 (cd $testroot/repo && got rebase -l > $testroot/stdout)
227 echo -n > $testroot/stdout.expected
228 cmp -s $testroot/stdout.expected $testroot/stdout
230 if [ $ret -ne 0 ]; then
231 diff -u $testroot/stdout.expected $testroot/stdout
233 test_done "$testroot" "$ret"
236 test_rebase_ancestry_check() {
237 local testroot=`test_init rebase_ancestry_check`
239 got checkout $testroot/repo $testroot/wt > /dev/null
241 if [ $ret -ne 0 ]; then
242 test_done "$testroot" "$ret"
246 (cd $testroot/repo && git checkout -q -b newbranch)
247 echo "modified delta on branch" > $testroot/repo/gamma/delta
248 git_commit $testroot/repo -m "committing to delta on newbranch"
249 local newbranch_id=`git_show_head $testroot/repo`
251 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
254 echo "refs/heads/newbranch is already based on refs/heads/master" \
255 > $testroot/stdout.expected
256 echo "Switching work tree from refs/heads/master to refs/heads/newbranch" \
257 >> $testroot/stdout.expected
258 echo "U gamma/delta" >> $testroot/stdout.expected
259 echo "Updated to refs/heads/newbranch: ${newbranch_id}" \
260 >> $testroot/stdout.expected
261 cmp -s $testroot/stdout.expected $testroot/stdout
263 if [ $ret -ne 0 ]; then
264 diff -u $testroot/stdout.expected $testroot/stdout
265 test_done "$testroot" "$ret"
269 echo -n > $testroot/stderr.expected
270 cmp -s $testroot/stderr.expected $testroot/stderr
272 if [ $ret -ne 0 ]; then
273 diff -u $testroot/stderr.expected $testroot/stderr
275 test_done "$testroot" "$ret"
278 test_rebase_continue() {
279 local testroot=`test_init rebase_continue`
280 local init_commit=`git_show_head $testroot/repo`
282 (cd $testroot/repo && git checkout -q -b newbranch)
283 echo "modified alpha on branch" > $testroot/repo/alpha
284 git_commit $testroot/repo -m "committing to alpha on newbranch"
285 local orig_commit1=`git_show_head $testroot/repo`
286 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
288 (cd $testroot/repo && git checkout -q master)
289 echo "modified alpha on master" > $testroot/repo/alpha
290 git_commit $testroot/repo -m "committing to alpha on master"
291 local master_commit=`git_show_head $testroot/repo`
293 got checkout $testroot/repo $testroot/wt > /dev/null
295 if [ $ret -ne 0 ]; then
296 test_done "$testroot" "$ret"
300 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
303 echo "C alpha" > $testroot/stdout.expected
304 echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
305 echo -n "$short_orig_commit1 -> merge conflict" \
306 >> $testroot/stdout.expected
307 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
308 cmp -s $testroot/stdout.expected $testroot/stdout
310 if [ $ret -ne 0 ]; then
311 diff -u $testroot/stdout.expected $testroot/stdout
312 test_done "$testroot" "$ret"
316 echo "got: conflicts must be resolved before rebasing can continue" \
317 > $testroot/stderr.expected
318 cmp -s $testroot/stderr.expected $testroot/stderr
320 if [ $ret -ne 0 ]; then
321 diff -u $testroot/stderr.expected $testroot/stderr
322 test_done "$testroot" "$ret"
326 echo '<<<<<<<' > $testroot/content.expected
327 echo "modified alpha on master" >> $testroot/content.expected
328 echo "||||||| 3-way merge base: commit $init_commit" \
329 >> $testroot/content.expected
330 echo "alpha" >> $testroot/content.expected
331 echo "=======" >> $testroot/content.expected
332 echo "modified alpha on branch" >> $testroot/content.expected
333 echo ">>>>>>> merged change: commit $orig_commit1" \
334 >> $testroot/content.expected
335 cat $testroot/wt/alpha > $testroot/content
336 cmp -s $testroot/content.expected $testroot/content
338 if [ $ret -ne 0 ]; then
339 diff -u $testroot/content.expected $testroot/content
340 test_done "$testroot" "$ret"
344 (cd $testroot/wt && got status > $testroot/stdout)
346 echo "C alpha" > $testroot/stdout.expected
347 cmp -s $testroot/stdout.expected $testroot/stdout
349 if [ $ret -ne 0 ]; then
350 diff -u $testroot/stdout.expected $testroot/stdout
351 test_done "$testroot" "$ret"
355 # resolve the conflict
356 echo "modified alpha on branch and master" > $testroot/wt/alpha
358 # test interaction of 'got stage' and rebase -c
359 (cd $testroot/wt && got stage alpha > /dev/null)
360 (cd $testroot/wt && got rebase -c > $testroot/stdout \
363 if [ $ret -eq 0 ]; then
364 echo "rebase succeeded unexpectedly" >&2
365 test_done "$testroot" "1"
368 echo -n "got: work tree contains files with staged changes; " \
369 > $testroot/stderr.expected
370 echo "these changes must be committed or unstaged first" \
371 >> $testroot/stderr.expected
372 cmp -s $testroot/stderr.expected $testroot/stderr
374 if [ $ret -ne 0 ]; then
375 diff -u $testroot/stderr.expected $testroot/stderr
376 test_done "$testroot" "$ret"
380 (cd $testroot/wt && got unstage alpha > /dev/null)
381 (cd $testroot/wt && got rebase -c > $testroot/stdout)
383 (cd $testroot/repo && git checkout -q newbranch)
384 local new_commit1=`git_show_head $testroot/repo`
385 local short_new_commit1=`trim_obj_id 28 $new_commit1`
387 echo -n "$short_orig_commit1 -> $short_new_commit1" \
388 > $testroot/stdout.expected
389 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
390 echo "Switching work tree to refs/heads/newbranch" \
391 >> $testroot/stdout.expected
393 cmp -s $testroot/stdout.expected $testroot/stdout
395 if [ $ret -ne 0 ]; then
396 diff -u $testroot/stdout.expected $testroot/stdout
397 test_done "$testroot" "$ret"
402 (cd $testroot/wt && got log -l2 | grep ^commit > $testroot/stdout)
403 echo "commit $new_commit1 (newbranch)" > $testroot/stdout.expected
404 echo "commit $master_commit (master)" >> $testroot/stdout.expected
405 cmp -s $testroot/stdout.expected $testroot/stdout
407 if [ $ret -ne 0 ]; then
408 diff -u $testroot/stdout.expected $testroot/stdout
410 test_done "$testroot" "$ret"
413 test_rebase_abort() {
414 local testroot=`test_init rebase_abort`
416 local init_commit=`git_show_head $testroot/repo`
418 (cd $testroot/repo && git checkout -q -b newbranch)
419 echo "modified alpha on branch" > $testroot/repo/alpha
420 git_commit $testroot/repo -m "committing to alpha on newbranch"
421 local orig_commit1=`git_show_head $testroot/repo`
422 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
424 (cd $testroot/repo && git checkout -q master)
425 echo "modified alpha on master" > $testroot/repo/alpha
426 git_commit $testroot/repo -m "committing to alpha on master"
427 local master_commit=`git_show_head $testroot/repo`
429 got checkout $testroot/repo $testroot/wt > /dev/null
431 if [ $ret -ne 0 ]; then
432 test_done "$testroot" "$ret"
436 # unrelated unversioned file in work tree
437 touch $testroot/wt/unversioned-file
439 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
442 echo "C alpha" > $testroot/stdout.expected
443 echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
444 echo -n "$short_orig_commit1 -> merge conflict" \
445 >> $testroot/stdout.expected
446 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
447 cmp -s $testroot/stdout.expected $testroot/stdout
449 if [ $ret -ne 0 ]; then
450 diff -u $testroot/stdout.expected $testroot/stdout
451 test_done "$testroot" "$ret"
455 echo "got: conflicts must be resolved before rebasing can continue" \
456 > $testroot/stderr.expected
457 cmp -s $testroot/stderr.expected $testroot/stderr
459 if [ $ret -ne 0 ]; then
460 diff -u $testroot/stderr.expected $testroot/stderr
461 test_done "$testroot" "$ret"
465 echo '<<<<<<<' > $testroot/content.expected
466 echo "modified alpha on master" >> $testroot/content.expected
467 echo "||||||| 3-way merge base: commit $init_commit" \
468 >> $testroot/content.expected
469 echo "alpha" >> $testroot/content.expected
470 echo "=======" >> $testroot/content.expected
471 echo "modified alpha on branch" >> $testroot/content.expected
472 echo ">>>>>>> merged change: commit $orig_commit1" \
473 >> $testroot/content.expected
474 cat $testroot/wt/alpha > $testroot/content
475 cmp -s $testroot/content.expected $testroot/content
477 if [ $ret -ne 0 ]; then
478 diff -u $testroot/content.expected $testroot/content
479 test_done "$testroot" "$ret"
483 (cd $testroot/wt && got status > $testroot/stdout)
485 echo "C alpha" > $testroot/stdout.expected
486 echo "? unversioned-file" >> $testroot/stdout.expected
487 cmp -s $testroot/stdout.expected $testroot/stdout
489 if [ $ret -ne 0 ]; then
490 diff -u $testroot/stdout.expected $testroot/stdout
491 test_done "$testroot" "$ret"
495 (cd $testroot/wt && got rebase -a > $testroot/stdout)
497 (cd $testroot/repo && git checkout -q newbranch)
499 echo "Switching work tree to refs/heads/master" \
500 > $testroot/stdout.expected
501 echo 'R alpha' >> $testroot/stdout.expected
502 echo "Rebase of refs/heads/newbranch aborted" \
503 >> $testroot/stdout.expected
505 cmp -s $testroot/stdout.expected $testroot/stdout
507 if [ $ret -ne 0 ]; then
508 diff -u $testroot/stdout.expected $testroot/stdout
509 test_done "$testroot" "$ret"
513 echo "modified alpha on master" > $testroot/content.expected
514 cat $testroot/wt/alpha > $testroot/content
515 cmp -s $testroot/content.expected $testroot/content
517 if [ $ret -ne 0 ]; then
518 diff -u $testroot/content.expected $testroot/content
519 test_done "$testroot" "$ret"
523 (cd $testroot/wt && got log -l3 -c newbranch \
524 | grep ^commit > $testroot/stdout)
525 echo "commit $orig_commit1 (newbranch)" > $testroot/stdout.expected
526 echo "commit $init_commit" >> $testroot/stdout.expected
527 cmp -s $testroot/stdout.expected $testroot/stdout
529 if [ $ret -ne 0 ]; then
530 diff -u $testroot/stdout.expected $testroot/stdout
532 test_done "$testroot" "$ret"
535 test_rebase_no_op_change() {
536 local testroot=`test_init rebase_no_op_change`
537 local init_commit=`git_show_head $testroot/repo`
539 (cd $testroot/repo && git checkout -q -b newbranch)
540 echo "modified alpha on branch" > $testroot/repo/alpha
541 git_commit $testroot/repo -m "committing to alpha on newbranch"
542 local orig_commit1=`git_show_head $testroot/repo`
543 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
545 (cd $testroot/repo && git checkout -q master)
546 echo "modified alpha on master" > $testroot/repo/alpha
547 git_commit $testroot/repo -m "committing to alpha on master"
548 local master_commit=`git_show_head $testroot/repo`
550 got checkout $testroot/repo $testroot/wt > /dev/null
552 if [ $ret -ne 0 ]; then
553 test_done "$testroot" "$ret"
557 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
560 echo "C alpha" > $testroot/stdout.expected
561 echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
562 echo -n "$short_orig_commit1 -> merge conflict" \
563 >> $testroot/stdout.expected
564 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
565 cmp -s $testroot/stdout.expected $testroot/stdout
567 if [ $ret -ne 0 ]; then
568 diff -u $testroot/stdout.expected $testroot/stdout
569 test_done "$testroot" "$ret"
573 echo "got: conflicts must be resolved before rebasing can continue" \
574 > $testroot/stderr.expected
575 cmp -s $testroot/stderr.expected $testroot/stderr
577 if [ $ret -ne 0 ]; then
578 diff -u $testroot/stderr.expected $testroot/stderr
579 test_done "$testroot" "$ret"
583 echo '<<<<<<<' > $testroot/content.expected
584 echo "modified alpha on master" >> $testroot/content.expected
585 echo "||||||| 3-way merge base: commit $init_commit" \
586 >> $testroot/content.expected
587 echo "alpha" >> $testroot/content.expected
588 echo "=======" >> $testroot/content.expected
589 echo "modified alpha on branch" >> $testroot/content.expected
590 echo ">>>>>>> merged change: commit $orig_commit1" \
591 >> $testroot/content.expected
592 cat $testroot/wt/alpha > $testroot/content
593 cmp -s $testroot/content.expected $testroot/content
595 if [ $ret -ne 0 ]; then
596 diff -u $testroot/content.expected $testroot/content
597 test_done "$testroot" "$ret"
601 (cd $testroot/wt && got status > $testroot/stdout)
603 echo "C alpha" > $testroot/stdout.expected
604 cmp -s $testroot/stdout.expected $testroot/stdout
606 if [ $ret -ne 0 ]; then
607 diff -u $testroot/stdout.expected $testroot/stdout
608 test_done "$testroot" "$ret"
612 # resolve the conflict
613 echo "modified alpha on master" > $testroot/wt/alpha
615 (cd $testroot/wt && got rebase -c > $testroot/stdout)
617 (cd $testroot/repo && git checkout -q newbranch)
618 local new_commit1=`git_show_head $testroot/repo`
620 echo -n "$short_orig_commit1 -> no-op change" \
621 > $testroot/stdout.expected
622 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
623 echo "Switching work tree to refs/heads/newbranch" \
624 >> $testroot/stdout.expected
626 cmp -s $testroot/stdout.expected $testroot/stdout
628 if [ $ret -ne 0 ]; then
629 diff -u $testroot/stdout.expected $testroot/stdout
630 test_done "$testroot" "$ret"
635 (cd $testroot/wt && got log -l2 | grep ^commit > $testroot/stdout)
636 echo "commit $master_commit (master, newbranch)" \
637 > $testroot/stdout.expected
638 echo "commit $init_commit" >> $testroot/stdout.expected
639 cmp -s $testroot/stdout.expected $testroot/stdout
641 if [ $ret -ne 0 ]; then
642 diff -u $testroot/stdout.expected $testroot/stdout
644 test_done "$testroot" "$ret"
647 test_rebase_in_progress() {
648 local testroot=`test_init rebase_in_progress`
649 local init_commit=`git_show_head $testroot/repo`
651 (cd $testroot/repo && git checkout -q -b newbranch)
652 echo "modified alpha on branch" > $testroot/repo/alpha
653 git_commit $testroot/repo -m "committing to alpha on newbranch"
654 local orig_commit1=`git_show_head $testroot/repo`
655 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
657 (cd $testroot/repo && git checkout -q master)
658 echo "modified alpha on master" > $testroot/repo/alpha
659 git_commit $testroot/repo -m "committing to alpha on master"
660 local master_commit=`git_show_head $testroot/repo`
662 got checkout $testroot/repo $testroot/wt > /dev/null
664 if [ $ret -ne 0 ]; then
665 test_done "$testroot" "$ret"
669 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
672 echo "C alpha" > $testroot/stdout.expected
673 echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
674 echo -n "$short_orig_commit1 -> merge conflict" \
675 >> $testroot/stdout.expected
676 echo ": committing to alpha on newbranch" >> $testroot/stdout.expected
677 cmp -s $testroot/stdout.expected $testroot/stdout
679 if [ $ret -ne 0 ]; then
680 diff -u $testroot/stdout.expected $testroot/stdout
681 test_done "$testroot" "$ret"
685 echo "got: conflicts must be resolved before rebasing can continue" \
686 > $testroot/stderr.expected
687 cmp -s $testroot/stderr.expected $testroot/stderr
689 if [ $ret -ne 0 ]; then
690 diff -u $testroot/stderr.expected $testroot/stderr
691 test_done "$testroot" "$ret"
695 echo '<<<<<<<' > $testroot/content.expected
696 echo "modified alpha on master" >> $testroot/content.expected
697 echo "||||||| 3-way merge base: commit $init_commit" \
698 >> $testroot/content.expected
699 echo "alpha" >> $testroot/content.expected
700 echo "=======" >> $testroot/content.expected
701 echo "modified alpha on branch" >> $testroot/content.expected
702 echo ">>>>>>> merged change: commit $orig_commit1" \
703 >> $testroot/content.expected
704 cat $testroot/wt/alpha > $testroot/content
705 cmp -s $testroot/content.expected $testroot/content
707 if [ $ret -ne 0 ]; then
708 diff -u $testroot/content.expected $testroot/content
709 test_done "$testroot" "$ret"
713 (cd $testroot/wt && got status > $testroot/stdout)
715 echo "C alpha" > $testroot/stdout.expected
716 cmp -s $testroot/stdout.expected $testroot/stdout
718 if [ $ret -ne 0 ]; then
719 diff -u $testroot/stdout.expected $testroot/stdout
720 test_done "$testroot" "$ret"
724 for cmd in update commit; do
725 (cd $testroot/wt && got $cmd > $testroot/stdout \
728 echo -n > $testroot/stdout.expected
729 cmp -s $testroot/stdout.expected $testroot/stdout
731 if [ $ret -ne 0 ]; then
732 diff -u $testroot/stdout.expected $testroot/stdout
733 test_done "$testroot" "$ret"
737 echo -n "got: a rebase operation is in progress in this " \
738 > $testroot/stderr.expected
739 echo "work tree and must be continued or aborted first" \
740 >> $testroot/stderr.expected
741 cmp -s $testroot/stderr.expected $testroot/stderr
743 if [ $ret -ne 0 ]; then
744 diff -u $testroot/stderr.expected $testroot/stderr
745 test_done "$testroot" "$ret"
750 test_done "$testroot" "$ret"
753 test_rebase_path_prefix() {
754 local testroot=`test_init rebase_path_prefix`
756 (cd $testroot/repo && git checkout -q -b newbranch)
757 echo "modified delta on branch" > $testroot/repo/gamma/delta
758 git_commit $testroot/repo -m "committing to delta on newbranch"
760 local orig_commit1=`git_show_parent_commit $testroot/repo`
761 local orig_commit2=`git_show_head $testroot/repo`
763 (cd $testroot/repo && git checkout -q master)
764 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
765 git_commit $testroot/repo -m "committing to zeta on master"
766 local master_commit=`git_show_head $testroot/repo`
768 got checkout -p epsilon $testroot/repo $testroot/wt > /dev/null
770 if [ $ret -ne 0 ]; then
771 test_done "$testroot" "$ret"
775 (cd $testroot/wt && got rebase newbranch \
776 > $testroot/stdout 2> $testroot/stderr)
778 echo -n > $testroot/stdout.expected
779 cmp -s $testroot/stdout.expected $testroot/stdout
781 if [ $ret -ne 0 ]; then
782 diff -u $testroot/stdout.expected $testroot/stdout
783 test_done "$testroot" "$ret"
787 echo -n "got: cannot rebase branch which contains changes outside " \
788 > $testroot/stderr.expected
789 echo "of this work tree's path prefix" >> $testroot/stderr.expected
790 cmp -s $testroot/stderr.expected $testroot/stderr
792 if [ $ret -ne 0 ]; then
793 diff -u $testroot/stderr.expected $testroot/stderr
794 test_done "$testroot" "$ret"
798 # rebase should succeed when using a complete work tree
799 got checkout $testroot/repo $testroot/wt2 > /dev/null
801 if [ $ret -ne 0 ]; then
802 test_done "$testroot" "$ret"
806 (cd $testroot/wt2 && got rebase newbranch \
807 > $testroot/stdout 2> $testroot/stderr)
809 (cd $testroot/repo && git checkout -q newbranch)
810 local new_commit1=`git_show_parent_commit $testroot/repo`
811 local new_commit2=`git_show_head $testroot/repo`
813 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
814 local short_new_commit2=`trim_obj_id 28 $new_commit2`
816 echo "G gamma/delta" > $testroot/stdout.expected
817 echo -n "$short_orig_commit2 -> $short_new_commit2" \
818 >> $testroot/stdout.expected
819 echo ": committing to delta on newbranch" \
820 >> $testroot/stdout.expected
821 echo "Switching work tree to refs/heads/newbranch" \
822 >> $testroot/stdout.expected
824 cmp -s $testroot/stdout.expected $testroot/stdout
826 if [ $ret -ne 0 ]; then
827 diff -u $testroot/stdout.expected $testroot/stdout
828 test_done "$testroot" "$ret"
832 # the first work tree should remain usable
833 (cd $testroot/wt && got update -b master \
834 > $testroot/stdout 2> $testroot/stderr)
836 if [ $ret -ne 0 ]; then
837 echo "update failed unexpectedly" >&2
838 test_done "$testroot" "1"
842 echo 'Already up-to-date' > $testroot/stdout.expected
843 cmp -s $testroot/stdout.expected $testroot/stdout
845 if [ $ret -ne 0 ]; then
846 diff -u $testroot/stdout.expected $testroot/stdout
848 test_done "$testroot" "$ret"
851 test_rebase_preserves_logmsg() {
852 local testroot=`test_init rebase_preserves_logmsg`
854 (cd $testroot/repo && git checkout -q -b newbranch)
855 echo "modified delta on branch" > $testroot/repo/gamma/delta
856 git_commit $testroot/repo -m "modified delta on newbranch"
858 echo "modified alpha on branch" > $testroot/repo/alpha
859 git_commit $testroot/repo -m "modified alpha on newbranch"
861 (cd $testroot/repo && got log -c newbranch -l2 | grep -v ^date: \
862 > $testroot/log.expected)
864 local orig_commit1=`git_show_parent_commit $testroot/repo`
865 local orig_commit2=`git_show_head $testroot/repo`
867 (cd $testroot/repo && git checkout -q master)
868 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
869 git_commit $testroot/repo -m "committing to zeta on master"
870 local master_commit=`git_show_head $testroot/repo`
872 got checkout $testroot/repo $testroot/wt > /dev/null
874 if [ $ret -ne 0 ]; then
875 test_done "$testroot" "$ret"
879 (cd $testroot/wt && got rebase newbranch > /dev/null \
882 (cd $testroot/repo && git checkout -q newbranch)
883 local new_commit1=`git_show_parent_commit $testroot/repo`
884 local new_commit2=`git_show_head $testroot/repo`
886 echo -n > $testroot/stderr.expected
887 cmp -s $testroot/stderr.expected $testroot/stderr
889 if [ $ret -ne 0 ]; then
890 diff -u $testroot/stderr.expected $testroot/stderr
891 test_done "$testroot" "$ret"
895 (cd $testroot/wt && got log -c newbranch -l2 | grep -v ^date: \
897 sed -i -e "s/$orig_commit1/$new_commit1/" $testroot/log.expected
898 sed -i -e "s/$orig_commit2/$new_commit2/" $testroot/log.expected
899 cmp -s $testroot/log.expected $testroot/log
901 if [ $ret -ne 0 ]; then
902 diff -u $testroot/log.expected $testroot/log
905 test_done "$testroot" "$ret"
908 test_rebase_no_commits_to_rebase() {
909 local testroot=`test_init rebase_no_commits_to_rebase`
911 got checkout $testroot/repo $testroot/wt > /dev/null
913 if [ $ret -ne 0 ]; then
914 test_done "$testroot" "$ret"
918 # Create an unrelated branch with 'got import'.
919 mkdir -p $testroot/newtree
920 echo "new file" > $testroot/newtree/newfile
921 got import -m new -b newbranch -r $testroot/repo \
922 $testroot/newtree > /dev/null
924 echo "modified alpha on master" > $testroot/wt/alpha
925 (cd $testroot/wt && got commit -m 'test rebase_no_commits_to_rebase' \
927 (cd $testroot/wt && got update > /dev/null)
929 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
932 echo -n "got: specified branch shares no common ancestry " \
933 > $testroot/stderr.expected
934 echo "with work tree's branch" >> $testroot/stderr.expected
935 cmp -s $testroot/stderr.expected $testroot/stderr
937 if [ $ret -ne 0 ]; then
938 diff -u $testroot/stderr.expected $testroot/stderr
939 test_done "$testroot" "$ret"
943 echo -n > $testroot/stdout.expected
944 cmp -s $testroot/stdout.expected $testroot/stdout
946 if [ $ret -ne 0 ]; then
947 diff -u $testroot/stdout.expected $testroot/stdout
948 test_done "$testroot" "$ret"
952 (cd $testroot/wt && got update > $testroot/stdout)
953 echo "Already up-to-date" > $testroot/stdout.expected
954 cmp -s $testroot/stdout.expected $testroot/stdout
956 if [ $ret -ne 0 ]; then
957 diff -u $testroot/stdout.expected $testroot/stdout
959 test_done "$testroot" "$ret"
962 test_rebase_forward() {
963 local testroot=`test_init rebase_forward`
964 local commit0=`git_show_head $testroot/repo`
966 got checkout $testroot/repo $testroot/wt > /dev/null
968 if [ $ret -ne 0 ]; then
969 test_done "$testroot" "$ret"
973 echo "change alpha 1" > $testroot/wt/alpha
974 (cd $testroot/wt && got commit -m 'test rebase_forward' \
976 local commit1=`git_show_head $testroot/repo`
978 echo "change alpha 2" > $testroot/wt/alpha
979 (cd $testroot/wt && got commit -m 'test rebase_forward' \
981 local commit2=`git_show_head $testroot/repo`
983 # Simulate a situation where fast-forward is required.
984 # We want to fast-forward master to origin/master:
985 # commit 3907e11dceaae2ca7f8db79c2af31794673945ad (origin/master)
986 # commit ffcffcd102cf1af6572fbdbb4cf07a0f1fd2d840 (master)
987 # commit 87a6a8a2263a15b61c016ff1720b24741d455eb5
988 (cd $testroot/repo && got ref -d master >/dev/null)
989 (cd $testroot/repo && got ref -c $commit1 refs/heads/master)
990 (cd $testroot/repo && got ref -c $commit2 refs/remotes/origin/master)
992 (cd $testroot/wt && got up -b origin/master > /dev/null)
994 (cd $testroot/wt && got rebase master \
995 > $testroot/stdout 2> $testroot/stderr)
997 echo "Forwarding refs/heads/master to commit $commit2" \
998 > $testroot/stdout.expected
999 echo "Switching work tree to refs/heads/master" \
1000 >> $testroot/stdout.expected
1001 cmp -s $testroot/stdout.expected $testroot/stdout
1003 if [ $ret -ne 0 ]; then
1004 diff -u $testroot/stdout.expected $testroot/stdout
1005 test_done "$testroot" "$ret"
1009 # Ensure that rebase operation was completed correctly
1010 (cd $testroot/wt && got rebase -a \
1011 > $testroot/stdout 2> $testroot/stderr)
1012 echo -n "" > $testroot/stdout.expected
1013 cmp -s $testroot/stdout.expected $testroot/stdout
1015 if [ $ret -ne 0 ]; then
1016 diff -u $testroot/stdout.expected $testroot/stdout
1017 test_done "$testroot" "$ret"
1020 echo "got: rebase operation not in progress" > $testroot/stderr.expected
1021 cmp -s $testroot/stderr.expected $testroot/stderr
1023 if [ $ret -ne 0 ]; then
1024 diff -u $testroot/stderr.expected $testroot/stderr
1025 test_done "$testroot" "$ret"
1029 (cd $testroot/wt && got branch -n > $testroot/stdout)
1030 echo "master" > $testroot/stdout.expected
1031 cmp -s $testroot/stdout.expected $testroot/stdout
1033 if [ $ret -ne 0 ]; then
1034 diff -u $testroot/stdout.expected $testroot/stdout
1035 test_done "$testroot" "$ret"
1039 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1040 echo "commit $commit2 (master, origin/master)" > $testroot/stdout.expected
1041 echo "commit $commit1" >> $testroot/stdout.expected
1042 echo "commit $commit0" >> $testroot/stdout.expected
1043 cmp -s $testroot/stdout.expected $testroot/stdout
1045 if [ $ret -ne 0 ]; then
1046 diff -u $testroot/stdout.expected $testroot/stdout
1047 test_done "$testroot" "$ret"
1051 # Forward-only rebase operations should not be backed up
1052 (cd $testroot/repo && got rebase -l > $testroot/stdout)
1053 echo -n > $testroot/stdout.expected
1054 cmp -s $testroot/stdout.expected $testroot/stdout
1056 if [ $ret -ne 0 ]; then
1057 diff -u $testroot/stdout.expected $testroot/stdout
1059 test_done "$testroot" "$ret"
1062 test_rebase_forward_path_prefix() {
1063 local testroot=`test_init rebase_forward_path_prefix`
1064 local commit0=`git_show_head $testroot/repo`
1066 got checkout $testroot/repo $testroot/wt-full > /dev/null
1068 if [ $ret -ne 0 ]; then
1069 test_done "$testroot" "$ret"
1073 echo "change alpha 1" > $testroot/wt-full/alpha
1074 (cd $testroot/wt-full && got commit -m 'test rebase_forward' \
1076 local commit1=`git_show_head $testroot/repo`
1078 echo "change alpha 2" > $testroot/wt-full/alpha
1079 (cd $testroot/wt-full && got commit -m 'test rebase_forward' \
1081 local commit2=`git_show_head $testroot/repo`
1083 # Simulate a situation where fast-forward is required.
1084 # We want to fast-forward master to origin/master:
1085 # commit 3907e11dceaae2ca7f8db79c2af31794673945ad (origin/master)
1086 # commit ffcffcd102cf1af6572fbdbb4cf07a0f1fd2d840 (master)
1087 # commit 87a6a8a2263a15b61c016ff1720b24741d455eb5
1088 (cd $testroot/repo && got ref -d master >/dev/null)
1089 (cd $testroot/repo && got ref -c $commit1 refs/heads/master)
1090 (cd $testroot/repo && got ref -c $commit2 refs/remotes/origin/master)
1092 # Work tree which uses a path-prefix and will be used for rebasing
1093 got checkout -p epsilon -b origin/master $testroot/repo $testroot/wt \
1096 if [ $ret -ne 0 ]; then
1097 test_done "$testroot" "$ret"
1101 (cd $testroot/wt && got rebase master \
1102 > $testroot/stdout 2> $testroot/stderr)
1104 echo "Forwarding refs/heads/master to commit $commit2" \
1105 > $testroot/stdout.expected
1106 echo "Switching work tree to refs/heads/master" \
1107 >> $testroot/stdout.expected
1108 cmp -s $testroot/stdout.expected $testroot/stdout
1110 if [ $ret -ne 0 ]; then
1111 diff -u $testroot/stdout.expected $testroot/stdout
1112 test_done "$testroot" "$ret"
1116 # Ensure that rebase operation was completed correctly
1117 (cd $testroot/wt && got rebase -a \
1118 > $testroot/stdout 2> $testroot/stderr)
1119 echo -n "" > $testroot/stdout.expected
1120 cmp -s $testroot/stdout.expected $testroot/stdout
1122 if [ $ret -ne 0 ]; then
1123 diff -u $testroot/stdout.expected $testroot/stdout
1124 test_done "$testroot" "$ret"
1127 echo "got: rebase operation not in progress" > $testroot/stderr.expected
1128 cmp -s $testroot/stderr.expected $testroot/stderr
1130 if [ $ret -ne 0 ]; then
1131 diff -u $testroot/stderr.expected $testroot/stderr
1132 test_done "$testroot" "$ret"
1136 (cd $testroot/wt && got branch -n > $testroot/stdout)
1137 echo "master" > $testroot/stdout.expected
1138 cmp -s $testroot/stdout.expected $testroot/stdout
1140 if [ $ret -ne 0 ]; then
1141 diff -u $testroot/stdout.expected $testroot/stdout
1142 test_done "$testroot" "$ret"
1146 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1147 echo "commit $commit2 (master, origin/master)" > $testroot/stdout.expected
1148 echo "commit $commit1" >> $testroot/stdout.expected
1149 echo "commit $commit0" >> $testroot/stdout.expected
1150 cmp -s $testroot/stdout.expected $testroot/stdout
1152 if [ $ret -ne 0 ]; then
1153 diff -u $testroot/stdout.expected $testroot/stdout
1154 test_done "$testroot" "$ret"
1158 # Forward-only rebase operations should not be backed up
1159 (cd $testroot/repo && got rebase -l > $testroot/stdout)
1160 echo -n > $testroot/stdout.expected
1161 cmp -s $testroot/stdout.expected $testroot/stdout
1163 if [ $ret -ne 0 ]; then
1164 diff -u $testroot/stdout.expected $testroot/stdout
1166 test_done "$testroot" "$ret"
1169 test_rebase_out_of_date() {
1170 local testroot=`test_init rebase_out_of_date`
1171 local initial_commit=`git_show_head $testroot/repo`
1173 (cd $testroot/repo && git checkout -q -b newbranch)
1174 echo "modified delta on branch" > $testroot/repo/gamma/delta
1175 git_commit $testroot/repo -m "committing to delta on newbranch"
1177 echo "modified alpha on branch" > $testroot/repo/alpha
1178 (cd $testroot/repo && git rm -q beta)
1179 echo "new file on branch" > $testroot/repo/epsilon/new
1180 (cd $testroot/repo && git add epsilon/new)
1181 git_commit $testroot/repo -m "committing more changes on newbranch"
1183 local orig_commit1=`git_show_parent_commit $testroot/repo`
1184 local orig_commit2=`git_show_head $testroot/repo`
1186 (cd $testroot/repo && git checkout -q master)
1187 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1188 git_commit $testroot/repo -m "committing to zeta on master"
1189 local master_commit1=`git_show_head $testroot/repo`
1191 (cd $testroot/repo && git checkout -q master)
1192 echo "modified beta on master" > $testroot/repo/beta
1193 git_commit $testroot/repo -m "committing to beta on master"
1194 local master_commit2=`git_show_head $testroot/repo`
1196 got checkout -c $master_commit1 $testroot/repo $testroot/wt \
1199 if [ $ret -ne 0 ]; then
1200 test_done "$testroot" "$ret"
1204 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
1205 2> $testroot/stderr)
1207 echo -n > $testroot/stdout.expected
1208 cmp -s $testroot/stdout.expected $testroot/stdout
1210 if [ $ret -ne 0 ]; then
1211 diff -u $testroot/stdout.expected $testroot/stdout
1212 test_done "$testroot" "$ret"
1216 echo -n "got: work tree must be updated before it can be " \
1217 > $testroot/stderr.expected
1218 echo "used to rebase a branch" >> $testroot/stderr.expected
1219 cmp -s $testroot/stderr.expected $testroot/stderr
1221 if [ $ret -ne 0 ]; then
1222 diff -u $testroot/stderr.expected $testroot/stderr
1223 test_done "$testroot" "$ret"
1227 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1228 echo "commit $master_commit2 (master)" > $testroot/stdout.expected
1229 echo "commit $master_commit1" >> $testroot/stdout.expected
1230 echo "commit $initial_commit" >> $testroot/stdout.expected
1231 cmp -s $testroot/stdout.expected $testroot/stdout
1233 if [ $ret -ne 0 ]; then
1234 diff -u $testroot/stdout.expected $testroot/stdout
1236 test_done "$testroot" "$ret"
1239 test_rebase_trims_empty_dir() {
1240 local testroot=`test_init rebase_trims_empty_dir`
1242 (cd $testroot/repo && git checkout -q -b newbranch)
1243 echo "modified delta on branch" > $testroot/repo/gamma/delta
1244 git_commit $testroot/repo -m "committing to delta on newbranch"
1246 (cd $testroot/repo && git rm -q epsilon/zeta)
1247 git_commit $testroot/repo -m "removing zeta on newbranch"
1249 local orig_commit1=`git_show_parent_commit $testroot/repo`
1250 local orig_commit2=`git_show_head $testroot/repo`
1252 (cd $testroot/repo && git checkout -q master)
1253 echo "modified alpha on master" > $testroot/repo/alpha
1254 git_commit $testroot/repo -m "committing to alpha on master"
1255 local master_commit=`git_show_head $testroot/repo`
1257 got checkout $testroot/repo $testroot/wt > /dev/null
1259 if [ $ret -ne 0 ]; then
1260 test_done "$testroot" "$ret"
1264 (cd $testroot/wt && got rebase newbranch > $testroot/stdout)
1266 (cd $testroot/repo && git checkout -q newbranch)
1267 local new_commit1=`git_show_parent_commit $testroot/repo`
1268 local new_commit2=`git_show_head $testroot/repo`
1270 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1271 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1272 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1273 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1275 echo "G gamma/delta" >> $testroot/stdout.expected
1276 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1277 >> $testroot/stdout.expected
1278 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1279 echo "D epsilon/zeta" >> $testroot/stdout.expected
1280 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1281 >> $testroot/stdout.expected
1282 echo ": removing zeta on newbranch" \
1283 >> $testroot/stdout.expected
1284 echo "Switching work tree to refs/heads/newbranch" \
1285 >> $testroot/stdout.expected
1287 cmp -s $testroot/stdout.expected $testroot/stdout
1289 if [ $ret -ne 0 ]; then
1290 diff -u $testroot/stdout.expected $testroot/stdout
1291 test_done "$testroot" "$ret"
1295 echo "modified delta on branch" > $testroot/content.expected
1296 cat $testroot/wt/gamma/delta > $testroot/content
1297 cmp -s $testroot/content.expected $testroot/content
1299 if [ $ret -ne 0 ]; then
1300 diff -u $testroot/content.expected $testroot/content
1301 test_done "$testroot" "$ret"
1305 echo "modified alpha on master" > $testroot/content.expected
1306 cat $testroot/wt/alpha > $testroot/content
1307 cmp -s $testroot/content.expected $testroot/content
1309 if [ $ret -ne 0 ]; then
1310 diff -u $testroot/content.expected $testroot/content
1311 test_done "$testroot" "$ret"
1315 if [ -e $testroot/wt/epsilon ]; then
1316 echo "parent of removed zeta still exists on disk" >&2
1317 test_done "$testroot" "1"
1321 (cd $testroot/wt && got status > $testroot/stdout)
1323 echo -n > $testroot/stdout.expected
1324 cmp -s $testroot/stdout.expected $testroot/stdout
1326 if [ $ret -ne 0 ]; then
1327 diff -u $testroot/stdout.expected $testroot/stdout
1328 test_done "$testroot" "$ret"
1332 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1333 echo "commit $new_commit2 (newbranch)" > $testroot/stdout.expected
1334 echo "commit $new_commit1" >> $testroot/stdout.expected
1335 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1336 cmp -s $testroot/stdout.expected $testroot/stdout
1338 if [ $ret -ne 0 ]; then
1339 diff -u $testroot/stdout.expected $testroot/stdout
1341 test_done "$testroot" "$ret"
1344 test_rebase_delete_missing_file() {
1345 local testroot=`test_init rebase_delete_missing_file`
1347 mkdir -p $testroot/repo/d/f/g
1348 echo "new file" > $testroot/repo/d/f/g/new
1349 (cd $testroot/repo && git add d/f/g/new)
1350 git_commit $testroot/repo -m "adding a subdir"
1351 local commit0=`git_show_head $testroot/repo`
1353 got br -r $testroot/repo -c master newbranch
1355 got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
1357 echo "modified delta on branch" > $testroot/wt/gamma/delta
1358 (cd $testroot/wt && got commit \
1359 -m "committing to delta on newbranch" > /dev/null)
1361 (cd $testroot/wt && got rm beta d/f/g/new > /dev/null)
1362 (cd $testroot/wt && got commit \
1363 -m "removing beta and d/f/g/new on newbranch" > /dev/null)
1365 (cd $testroot/repo && git checkout -q newbranch)
1366 local orig_commit1=`git_show_parent_commit $testroot/repo`
1367 local orig_commit2=`git_show_head $testroot/repo`
1369 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1370 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1372 (cd $testroot/wt && got update -b master > /dev/null)
1373 (cd $testroot/wt && got rm beta d/f/g/new > /dev/null)
1374 (cd $testroot/wt && got commit \
1375 -m "removing beta and d/f/g/new on master" > /dev/null)
1377 (cd $testroot/repo && git checkout -q master)
1378 local master_commit=`git_show_head $testroot/repo`
1380 (cd $testroot/wt && got update -b master > /dev/null)
1381 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
1382 2> $testroot/stderr)
1384 if [ $ret -eq 0 ]; then
1385 echo "rebase succeeded unexpectedly" >&2
1386 test_done "$testroot" "1"
1390 local new_commit1=$(cd $testroot/wt && got info | \
1391 grep '^work tree base commit: ' | cut -d: -f2 | tr -d ' ')
1393 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1394 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1396 echo "G gamma/delta" >> $testroot/stdout.expected
1397 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1398 >> $testroot/stdout.expected
1399 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1400 echo "! beta" >> $testroot/stdout.expected
1401 echo "! d/f/g/new" >> $testroot/stdout.expected
1402 echo -n "Files which had incoming changes but could not be found " \
1403 >> $testroot/stdout.expected
1404 echo "in the work tree: 2" >> $testroot/stdout.expected
1405 cmp -s $testroot/stdout.expected $testroot/stdout
1407 if [ $ret -ne 0 ]; then
1408 diff -u $testroot/stdout.expected $testroot/stdout
1409 test_done "$testroot" "$ret"
1413 echo -n "got: changes destined for some files were not yet merged " \
1414 > $testroot/stderr.expected
1415 echo -n "and should be merged manually if required before the " \
1416 >> $testroot/stderr.expected
1417 echo "rebase operation is continued" >> $testroot/stderr.expected
1418 cmp -s $testroot/stderr.expected $testroot/stderr
1420 if [ $ret -ne 0 ]; then
1421 diff -u $testroot/stderr.expected $testroot/stderr
1422 test_done "$testroot" "$ret"
1426 # ignore the missing changes and continue
1427 (cd $testroot/wt && got rebase -c > $testroot/stdout)
1429 if [ $ret -ne 0 ]; then
1430 echo "rebase failed unexpectedly" >&2
1431 test_done "$testroot" "1"
1434 echo -n "$short_orig_commit2 -> no-op change" \
1435 > $testroot/stdout.expected
1436 echo ": removing beta and d/f/g/new on newbranch" \
1437 >> $testroot/stdout.expected
1438 echo "Switching work tree to refs/heads/newbranch" \
1439 >> $testroot/stdout.expected
1441 cmp -s $testroot/stdout.expected $testroot/stdout
1443 if [ $ret -ne 0 ]; then
1444 diff -u $testroot/stdout.expected $testroot/stdout
1445 test_done "$testroot" "$ret"
1449 echo "modified delta on branch" > $testroot/content.expected
1450 cat $testroot/wt/gamma/delta > $testroot/content
1451 cmp -s $testroot/content.expected $testroot/content
1453 if [ $ret -ne 0 ]; then
1454 diff -u $testroot/content.expected $testroot/content
1455 test_done "$testroot" "$ret"
1459 if [ -e $testroot/wt/beta ]; then
1460 echo "removed file beta still exists on disk" >&2
1461 test_done "$testroot" "1"
1465 (cd $testroot/wt && got status > $testroot/stdout)
1467 echo -n > $testroot/stdout.expected
1468 cmp -s $testroot/stdout.expected $testroot/stdout
1470 if [ $ret -ne 0 ]; then
1471 diff -u $testroot/stdout.expected $testroot/stdout
1472 test_done "$testroot" "$ret"
1476 (cd $testroot/repo && git checkout -q newbranch)
1477 local new_commit1=`git_show_head $testroot/repo`
1478 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1480 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1481 echo "commit $new_commit1 (newbranch)" > $testroot/stdout.expected
1482 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1483 echo "commit $commit0" >> $testroot/stdout.expected
1484 cmp -s $testroot/stdout.expected $testroot/stdout
1486 if [ $ret -ne 0 ]; then
1487 diff -u $testroot/stdout.expected $testroot/stdout
1489 test_done "$testroot" "$ret"
1492 test_rebase_rm_add_rm_file() {
1493 local testroot=`test_init rebase_rm_add_rm_file`
1495 (cd $testroot/repo && git checkout -q -b newbranch)
1496 (cd $testroot/repo && git rm -q beta)
1497 git_commit $testroot/repo -m "removing beta from newbranch"
1498 local orig_commit1=`git_show_head $testroot/repo`
1500 echo 'restored beta' > $testroot/repo/beta
1501 (cd $testroot/repo && git add beta)
1502 git_commit $testroot/repo -m "restoring beta on newbranch"
1503 local orig_commit2=`git_show_head $testroot/repo`
1505 (cd $testroot/repo && git rm -q beta)
1506 git_commit $testroot/repo -m "removing beta from newbranch again"
1507 local orig_commit3=`git_show_head $testroot/repo`
1509 (cd $testroot/repo && git checkout -q master)
1510 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1511 git_commit $testroot/repo -m "committing to zeta on master"
1512 local master_commit=`git_show_head $testroot/repo`
1514 got checkout $testroot/repo $testroot/wt > /dev/null
1516 if [ $ret -ne 0 ]; then
1517 test_done "$testroot" "$ret"
1521 (cd $testroot/wt && got rebase newbranch > $testroot/stdout)
1523 # this would error out with 'got: file index is corrupt'
1524 (cd $testroot/wt && got status > /dev/null)
1526 if [ $ret -ne 0 ]; then
1527 echo "got status command failed unexpectedly" >&2
1528 test_done "$testroot" "$ret"
1532 (cd $testroot/repo && git checkout -q newbranch)
1533 local new_commit3=`git_show_head $testroot/repo`
1534 local new_commit2=`git_show_parent_commit $testroot/repo`
1535 local new_commit1=`git_show_parent_commit $testroot/repo $new_commit2`
1537 (cd $testroot/repo && git checkout -q newbranch)
1539 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1540 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1541 local short_orig_commit3=`trim_obj_id 28 $orig_commit3`
1542 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1543 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1544 local short_new_commit3=`trim_obj_id 28 $new_commit3`
1546 echo "D beta" > $testroot/stdout.expected
1547 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1548 >> $testroot/stdout.expected
1549 echo ": removing beta from newbranch" >> $testroot/stdout.expected
1550 echo "A beta" >> $testroot/stdout.expected
1551 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1552 >> $testroot/stdout.expected
1553 echo ": restoring beta on newbranch" >> $testroot/stdout.expected
1554 echo "D beta" >> $testroot/stdout.expected
1555 echo -n "$short_orig_commit3 -> $short_new_commit3" \
1556 >> $testroot/stdout.expected
1557 echo ": removing beta from newbranch again" >> $testroot/stdout.expected
1558 echo "Switching work tree to refs/heads/newbranch" \
1559 >> $testroot/stdout.expected
1561 cmp -s $testroot/stdout.expected $testroot/stdout
1563 if [ $ret -ne 0 ]; then
1564 diff -u $testroot/stdout.expected $testroot/stdout
1565 test_done "$testroot" "$ret"
1569 (cd $testroot/wt && got status > $testroot/stdout)
1571 if [ $ret -ne 0 ]; then
1572 echo "got status command failed unexpectedly" >&2
1573 test_done "$testroot" "$ret"
1577 echo -n > $testroot/stdout.expected
1578 cmp -s $testroot/stdout.expected $testroot/stdout
1580 if [ $ret -ne 0 ]; then
1581 diff -u $testroot/stdout.expected $testroot/stdout
1582 test_done "$testroot" "$ret"
1586 (cd $testroot/wt && got log -l4 | grep ^commit > $testroot/stdout)
1587 echo "commit $new_commit3 (newbranch)" > $testroot/stdout.expected
1588 echo "commit $new_commit2" >> $testroot/stdout.expected
1589 echo "commit $new_commit1" >> $testroot/stdout.expected
1590 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1591 cmp -s $testroot/stdout.expected $testroot/stdout
1593 if [ $ret -ne 0 ]; then
1594 diff -u $testroot/stdout.expected $testroot/stdout
1596 test_done "$testroot" "$ret"
1599 test_rebase_resets_committer() {
1600 local testroot=`test_init rebase_resets_committer`
1601 local commit0=`git_show_head $testroot/repo`
1602 local commit0_author_time=`git_show_author_time $testroot/repo`
1603 local committer="Flan Luck <flan_luck@openbsd.org>"
1605 (cd $testroot/repo && git checkout -q -b newbranch)
1606 echo "modified delta on branch" > $testroot/repo/gamma/delta
1607 git_commit $testroot/repo -m "committing to delta on newbranch"
1609 echo "modified alpha on branch" > $testroot/repo/alpha
1610 git_commit $testroot/repo -m "committing more changes on newbranch"
1612 local orig_commit1=`git_show_parent_commit $testroot/repo`
1613 local orig_commit2=`git_show_head $testroot/repo`
1614 local orig_author_time2=`git_show_author_time $testroot/repo`
1616 (cd $testroot/repo && git checkout -q master)
1617 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1618 git_commit $testroot/repo -m "committing to zeta on master"
1619 local master_commit=`git_show_head $testroot/repo`
1621 got checkout $testroot/repo $testroot/wt > /dev/null
1623 if [ $ret -ne 0 ]; then
1624 test_done "$testroot" "$ret"
1628 (cd $testroot/wt && env GOT_AUTHOR="$committer" \
1629 got rebase newbranch > $testroot/stdout)
1631 (cd $testroot/repo && git checkout -q newbranch)
1632 local new_commit1=`git_show_parent_commit $testroot/repo`
1633 local new_commit2=`git_show_head $testroot/repo`
1634 local new_author_time2=`git_show_author_time $testroot/repo`
1636 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1637 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1638 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1639 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1641 echo "G gamma/delta" >> $testroot/stdout.expected
1642 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1643 >> $testroot/stdout.expected
1644 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1645 echo "G alpha" >> $testroot/stdout.expected
1646 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1647 >> $testroot/stdout.expected
1648 echo ": committing more changes on newbranch" \
1649 >> $testroot/stdout.expected
1650 echo "Switching work tree to refs/heads/newbranch" \
1651 >> $testroot/stdout.expected
1653 cmp -s $testroot/stdout.expected $testroot/stdout
1655 if [ $ret -ne 0 ]; then
1656 diff -u $testroot/stdout.expected $testroot/stdout
1657 test_done "$testroot" "$ret"
1661 # Original commit only had one author
1662 (cd $testroot/repo && got log -l1 -c $orig_commit2 | \
1663 egrep '^(from|via):' > $testroot/stdout)
1664 echo "from: $GOT_AUTHOR" > $testroot/stdout.expected
1665 cmp -s $testroot/stdout.expected $testroot/stdout
1667 if [ $ret -ne 0 ]; then
1668 diff -u $testroot/stdout.expected $testroot/stdout
1669 test_done "$testroot" "$ret"
1673 # Rebased commit should have new committer name added
1674 (cd $testroot/repo && got log -l1 -c $new_commit2 | \
1675 egrep '^(from|via):' > $testroot/stdout)
1676 echo "from: $GOT_AUTHOR" > $testroot/stdout.expected
1677 echo "via: $committer" >> $testroot/stdout.expected
1679 cmp -s $testroot/stdout.expected $testroot/stdout
1681 if [ $ret -ne 0 ]; then
1682 diff -u $testroot/stdout.expected $testroot/stdout
1684 test_done "$testroot" "$ret"
1687 test_rebase_no_author_info() {
1688 local testroot=`test_init rebase_no_author_info`
1689 local commit0=`git_show_head $testroot/repo`
1690 local commit0_author_time=`git_show_author_time $testroot/repo`
1691 local committer="$GOT_AUTHOR"
1693 (cd $testroot/repo && git checkout -q -b newbranch)
1694 echo "modified delta on branch" > $testroot/repo/gamma/delta
1695 git_commit $testroot/repo -m "committing to delta on newbranch"
1697 echo "modified alpha on branch" > $testroot/repo/alpha
1698 git_commit $testroot/repo -m "committing more changes on newbranch"
1700 local orig_commit1=`git_show_parent_commit $testroot/repo`
1701 local orig_commit2=`git_show_head $testroot/repo`
1702 local orig_author_time2=`git_show_author_time $testroot/repo`
1704 (cd $testroot/repo && git checkout -q master)
1705 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1706 git_commit $testroot/repo -m "committing to zeta on master"
1707 local master_commit=`git_show_head $testroot/repo`
1709 got checkout $testroot/repo $testroot/wt > /dev/null
1711 if [ $ret -ne 0 ]; then
1712 test_done "$testroot" "$ret"
1716 # unset in a subshell to avoid affecting our environment
1717 (unset GOT_AUTHOR && cd $testroot/wt && \
1718 got rebase newbranch > $testroot/stdout)
1720 (cd $testroot/repo && git checkout -q newbranch)
1721 local new_commit1=`git_show_parent_commit $testroot/repo`
1722 local new_commit2=`git_show_head $testroot/repo`
1723 local new_author_time2=`git_show_author_time $testroot/repo`
1725 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1726 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1727 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1728 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1730 echo "G gamma/delta" >> $testroot/stdout.expected
1731 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1732 >> $testroot/stdout.expected
1733 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1734 echo "G alpha" >> $testroot/stdout.expected
1735 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1736 >> $testroot/stdout.expected
1737 echo ": committing more changes on newbranch" \
1738 >> $testroot/stdout.expected
1739 echo "Switching work tree to refs/heads/newbranch" \
1740 >> $testroot/stdout.expected
1742 cmp -s $testroot/stdout.expected $testroot/stdout
1744 if [ $ret -ne 0 ]; then
1745 diff -u $testroot/stdout.expected $testroot/stdout
1746 test_done "$testroot" "$ret"
1750 # Original commit only had one author
1751 (cd $testroot/repo && got log -l1 -c $orig_commit2 | \
1752 egrep '^(from|via):' > $testroot/stdout)
1753 echo "from: $committer" > $testroot/stdout.expected
1754 cmp -s $testroot/stdout.expected $testroot/stdout
1756 if [ $ret -ne 0 ]; then
1757 diff -u $testroot/stdout.expected $testroot/stdout
1758 test_done "$testroot" "$ret"
1762 # Author info of rebased commit should match the original
1763 (cd $testroot/repo && got log -l1 -c $new_commit2 | \
1764 egrep '^(from|via):' > $testroot/stdout)
1765 echo "from: $committer" > $testroot/stdout.expected
1767 cmp -s $testroot/stdout.expected $testroot/stdout
1769 if [ $ret -ne 0 ]; then
1770 diff -u $testroot/stdout.expected $testroot/stdout
1772 test_done "$testroot" "$ret"
1775 test_rebase_nonbranch() {
1776 local testroot=`test_init rebase_nonbranch`
1778 got ref -r $testroot/repo -c refs/heads/master \
1779 refs/remotes/origin/master >/dev/null
1781 got checkout -b master $testroot/repo $testroot/wt >/dev/null
1783 (cd $testroot/wt && got rebase origin/master > $testroot/stdout \
1784 2> $testroot/stderr)
1786 if [ $ret -eq 0 ]; then
1787 echo "rebase succeeded unexpectedly" >&2
1788 test_done "$testroot" "1"
1791 echo -n "got: will not rebase a branch which lives outside the " \
1792 > $testroot/stderr.expected
1793 echo '"refs/heads/" reference namespace' >> $testroot/stderr.expected
1794 cmp -s $testroot/stderr.expected $testroot/stderr
1796 if [ $ret -ne 0 ]; then
1797 diff -u $testroot/stderr.expected $testroot/stderr
1799 test_done "$testroot" "$ret"
1802 test_rebase_umask() {
1803 local testroot=`test_init rebase_umask`
1804 local commit0=`git_show_head "$testroot/repo"`
1806 got checkout "$testroot/repo" "$testroot/wt" >/dev/null
1807 (cd "$testroot/wt" && got branch newbranch) >/dev/null
1809 echo "modified alpha on branch" >$testroot/wt/alpha
1810 (cd "$testroot/wt" && got commit -m 'modified alpha on newbranch') \
1813 (cd "$testroot/wt" && got update -b master) >/dev/null
1815 if [ $ret -ne 0 ]; then
1816 echo "got update failed!" >&2
1817 test_done "$testroot" $ret
1821 echo "modified beta on master" >$testroot/wt/beta
1822 (cd "$testroot/wt" && got commit -m 'modified beta on master') \
1824 (cd "$testroot/wt" && got update) >/dev/null
1826 # using a subshell to avoid clobbering global umask
1827 (umask 077 && cd "$testroot/wt" && got rebase newbranch) >/dev/null
1829 if [ $ret -ne 0 ]; then
1830 echo "got rebase failed" >&2
1831 test_done "$testroot" $ret
1835 ls -l "$testroot/wt/alpha" | grep -q ^-rw-------
1836 if [ $? -ne 0 ]; then
1837 echo "alpha is not 0600 after rebase" >&2
1838 ls -l "$testroot/wt/alpha" >&2
1839 test_done "$testroot" 1
1843 test_done "$testroot" 0
1846 test_rebase_out_of_date2() {
1847 local testroot=`test_init rebase_out_of_date2`
1848 local commit0=`git_show_head $testroot/repo`
1849 local commit0_author_time=`git_show_author_time $testroot/repo`
1851 (cd $testroot/repo && git checkout -q -b newbranch)
1852 echo "modified delta on branch" > $testroot/repo/gamma/delta
1853 git_commit $testroot/repo -m "committing to delta on newbranch"
1855 local orig_commit1=`git_show_parent_commit $testroot/repo`
1856 local orig_commit2=`git_show_head $testroot/repo`
1857 local orig_author_time2=`git_show_author_time $testroot/repo`
1859 (cd $testroot/repo && git checkout -q master)
1860 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1861 git_commit $testroot/repo -m "committing to zeta on master"
1862 local master_commit=`git_show_head $testroot/repo`
1864 got checkout $testroot/repo $testroot/wt > /dev/null
1866 if [ $ret -ne 0 ]; then
1867 test_done "$testroot" "$ret"
1871 # Backdate the file alpha to an earlier version.
1872 # This sets the work tree's base commit ID back to $commit0,
1873 # which is out-of-date with respect to the master branch.
1874 (cd $testroot/wt && got update -c $commit0 alpha > /dev/null)
1876 # Rebase into an out-of-date work tree should be refused.
1877 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
1878 2> $testroot/stderr)
1880 if [ $ret -eq 0 ]; then
1881 echo "rebase succeeded unexpectedly" >&2
1882 test_done "$testroot" "1"
1885 echo -n > $testroot/stdout.expected
1886 echo -n "got: work tree must be updated before it can be used to " \
1887 > $testroot/stderr.expected
1888 echo "rebase a branch" >> $testroot/stderr.expected
1889 cmp -s $testroot/stderr.expected $testroot/stderr
1891 if [ $ret -ne 0 ]; then
1892 diff -u $testroot/stderr.expected $testroot/stderr
1894 test_done "$testroot" "$ret"
1897 test_rebase_one_commit() {
1898 local testroot=`test_init rebase_one_commit`
1900 if ! got checkout $testroot/repo $testroot/wt >/dev/null; then
1901 test_done "$testroot" 1
1905 (cd $testroot/wt && got branch newbranch) >/dev/null
1907 echo "modified alpha on newbranch" >$testroot/wt/alpha
1908 (cd $testroot/wt && got commit -m 'edit alpha') >/dev/null
1909 (cd $testroot/wt && got update) >/dev/null
1910 local commit=`git_show_branch_head $testroot/repo newbranch`
1912 echo -n '' > $testroot/stderr.expected
1914 (cd $testroot/wt && got rebase master >$testroot/stdout \
1915 2> $testroot/stderr)
1917 if [ $ret -ne 0 ]; then
1918 echo "rebase comand failed unexpectedly" >&2
1919 diff -u $testroot/stderr.expected $testroot/stderr
1920 test_done "$testroot" "1"
1924 echo "Forwarding refs/heads/master to commit $commit" \
1925 >$testroot/stdout.expected
1926 echo "Switching work tree to refs/heads/master" \
1927 >> $testroot/stdout.expected
1929 if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
1930 diff -u $testroot/stdout.expected $testroot/stdout
1931 test_done "$testroot" 1
1935 test_done "$testroot" 0
1939 run_test test_rebase_basic
1940 run_test test_rebase_ancestry_check
1941 run_test test_rebase_continue
1942 run_test test_rebase_abort
1943 run_test test_rebase_no_op_change
1944 run_test test_rebase_in_progress
1945 run_test test_rebase_path_prefix
1946 run_test test_rebase_preserves_logmsg
1947 run_test test_rebase_no_commits_to_rebase
1948 run_test test_rebase_forward
1949 run_test test_rebase_forward_path_prefix
1950 run_test test_rebase_out_of_date
1951 run_test test_rebase_trims_empty_dir
1952 run_test test_rebase_delete_missing_file
1953 run_test test_rebase_rm_add_rm_file
1954 run_test test_rebase_resets_committer
1955 run_test test_rebase_no_author_info
1956 run_test test_rebase_nonbranch
1957 run_test test_rebase_umask
1958 run_test test_rebase_out_of_date2
1959 run_test test_rebase_one_commit