Blob


1 #!/bin/sh
2 #
3 # Copyright (c) 2019, 2020 Stefan Sperling <stsp@openbsd.org>
4 #
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.
8 #
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.
17 . ./common.sh
19 test_rebase_basic() {
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
44 ret=$?
45 if [ $ret -ne 0 ]; then
46 test_done "$testroot" "$ret"
47 return 1
48 fi
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
77 ret=$?
78 if [ $ret -ne 0 ]; then
79 diff -u $testroot/stdout.expected $testroot/stdout
80 test_done "$testroot" "$ret"
81 return 1
82 fi
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
87 ret=$?
88 if [ $ret -ne 0 ]; then
89 diff -u $testroot/content.expected $testroot/content
90 test_done "$testroot" "$ret"
91 return 1
92 fi
94 echo "modified alpha on branch" > $testroot/content.expected
95 cat $testroot/wt/alpha > $testroot/content
96 cmp -s $testroot/content.expected $testroot/content
97 ret=$?
98 if [ $ret -ne 0 ]; then
99 diff -u $testroot/content.expected $testroot/content
100 test_done "$testroot" "$ret"
101 return 1
102 fi
104 if [ -e $testroot/wt/beta ]; then
105 echo "removed file beta still exists on disk" >&2
106 test_done "$testroot" "1"
107 return 1
108 fi
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
113 ret=$?
114 if [ $ret -ne 0 ]; then
115 diff -u $testroot/content.expected $testroot/content
116 test_done "$testroot" "$ret"
117 return 1
118 fi
120 (cd $testroot/wt && got status > $testroot/stdout)
122 echo -n > $testroot/stdout.expected
123 cmp -s $testroot/stdout.expected $testroot/stdout
124 ret=$?
125 if [ $ret -ne 0 ]; then
126 diff -u $testroot/stdout.expected $testroot/stdout
127 test_done "$testroot" "$ret"
128 return 1
129 fi
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
136 ret=$?
137 if [ $ret -ne 0 ]; then
138 diff -u $testroot/stdout.expected $testroot/stdout
139 test_done "$testroot" "$ret"
140 return 1
141 fi
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
147 ret=$?
148 if [ $ret -ne 0 ]; then
149 diff -u $testroot/stdout.expected $testroot/stdout
150 test_done "$testroot" "$ret"
151 return 1
152 fi
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"
157 export LC_TIME=C
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)
165 from: $GOT_AUTHOR
166 date: $d_orig2
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
174 EOF
175 cmp -s $testroot/stdout.expected $testroot/stdout
176 ret=$?
177 if [ $ret -ne 0 ]; then
178 diff -u $testroot/stdout.expected $testroot/stdout
179 test_done "$testroot" "$ret"
180 return 1
181 fi
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
190 ret=$?
191 if [ $ret -ne 0 ]; then
192 diff -u $testroot/stdout.expected $testroot/stdout
193 test_done "$testroot" "$ret"
194 return 1
195 fi
196 cmp -s $testroot/stderr.expected $testroot/stderr
197 ret=$?
198 if [ $ret -ne 0 ]; then
199 diff -u $testroot/stderr.expected $testroot/stderr
200 test_done "$testroot" "$ret"
201 return 1
202 fi
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
212 ret=$?
213 if [ $ret -ne 0 ]; then
214 diff -u $testroot/stdout.expected $testroot/stdout
215 test_done "$testroot" "$ret"
216 return 1
217 fi
218 cmp -s $testroot/stderr.expected $testroot/stderr
219 ret=$?
220 if [ $ret -ne 0 ]; then
221 diff -u $testroot/stderr.expected $testroot/stderr
222 test_done "$testroot" "$ret"
223 return 1
224 fi
226 (cd $testroot/repo && got rebase -l > $testroot/stdout)
227 echo -n > $testroot/stdout.expected
228 cmp -s $testroot/stdout.expected $testroot/stdout
229 ret=$?
230 if [ $ret -ne 0 ]; then
231 diff -u $testroot/stdout.expected $testroot/stdout
232 fi
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
240 ret=$?
241 if [ $ret -ne 0 ]; then
242 test_done "$testroot" "$ret"
243 return 1
244 fi
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 \
252 2> $testroot/stderr)
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
262 ret=$?
263 if [ $ret -ne 0 ]; then
264 diff -u $testroot/stdout.expected $testroot/stdout
265 test_done "$testroot" "$ret"
266 return 1
267 fi
269 echo -n > $testroot/stderr.expected
270 cmp -s $testroot/stderr.expected $testroot/stderr
271 ret=$?
272 if [ $ret -ne 0 ]; then
273 diff -u $testroot/stderr.expected $testroot/stderr
274 fi
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
294 ret=$?
295 if [ $ret -ne 0 ]; then
296 test_done "$testroot" "$ret"
297 return 1
298 fi
300 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
301 2> $testroot/stderr)
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
309 ret=$?
310 if [ $ret -ne 0 ]; then
311 diff -u $testroot/stdout.expected $testroot/stdout
312 test_done "$testroot" "$ret"
313 return 1
314 fi
316 echo "got: conflicts must be resolved before rebasing can continue" \
317 > $testroot/stderr.expected
318 cmp -s $testroot/stderr.expected $testroot/stderr
319 ret=$?
320 if [ $ret -ne 0 ]; then
321 diff -u $testroot/stderr.expected $testroot/stderr
322 test_done "$testroot" "$ret"
323 return 1
324 fi
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
337 ret=$?
338 if [ $ret -ne 0 ]; then
339 diff -u $testroot/content.expected $testroot/content
340 test_done "$testroot" "$ret"
341 return 1
342 fi
344 (cd $testroot/wt && got status > $testroot/stdout)
346 echo "C alpha" > $testroot/stdout.expected
347 cmp -s $testroot/stdout.expected $testroot/stdout
348 ret=$?
349 if [ $ret -ne 0 ]; then
350 diff -u $testroot/stdout.expected $testroot/stdout
351 test_done "$testroot" "$ret"
352 return 1
353 fi
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 \
361 2> $testroot/stderr)
362 ret=$?
363 if [ $ret -eq 0 ]; then
364 echo "rebase succeeded unexpectedly" >&2
365 test_done "$testroot" "1"
366 return 1
367 fi
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
373 ret=$?
374 if [ $ret -ne 0 ]; then
375 diff -u $testroot/stderr.expected $testroot/stderr
376 test_done "$testroot" "$ret"
377 return 1
378 fi
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
394 ret=$?
395 if [ $ret -ne 0 ]; then
396 diff -u $testroot/stdout.expected $testroot/stdout
397 test_done "$testroot" "$ret"
398 return 1
399 fi
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
406 ret=$?
407 if [ $ret -ne 0 ]; then
408 diff -u $testroot/stdout.expected $testroot/stdout
409 fi
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
430 ret=$?
431 if [ $ret -ne 0 ]; then
432 test_done "$testroot" "$ret"
433 return 1
434 fi
436 # unrelated unversioned file in work tree
437 touch $testroot/wt/unversioned-file
439 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
440 2> $testroot/stderr)
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
448 ret=$?
449 if [ $ret -ne 0 ]; then
450 diff -u $testroot/stdout.expected $testroot/stdout
451 test_done "$testroot" "$ret"
452 return 1
453 fi
455 echo "got: conflicts must be resolved before rebasing can continue" \
456 > $testroot/stderr.expected
457 cmp -s $testroot/stderr.expected $testroot/stderr
458 ret=$?
459 if [ $ret -ne 0 ]; then
460 diff -u $testroot/stderr.expected $testroot/stderr
461 test_done "$testroot" "$ret"
462 return 1
463 fi
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
476 ret=$?
477 if [ $ret -ne 0 ]; then
478 diff -u $testroot/content.expected $testroot/content
479 test_done "$testroot" "$ret"
480 return 1
481 fi
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
488 ret=$?
489 if [ $ret -ne 0 ]; then
490 diff -u $testroot/stdout.expected $testroot/stdout
491 test_done "$testroot" "$ret"
492 return 1
493 fi
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
506 ret=$?
507 if [ $ret -ne 0 ]; then
508 diff -u $testroot/stdout.expected $testroot/stdout
509 test_done "$testroot" "$ret"
510 return 1
511 fi
513 echo "modified alpha on master" > $testroot/content.expected
514 cat $testroot/wt/alpha > $testroot/content
515 cmp -s $testroot/content.expected $testroot/content
516 ret=$?
517 if [ $ret -ne 0 ]; then
518 diff -u $testroot/content.expected $testroot/content
519 test_done "$testroot" "$ret"
520 return 1
521 fi
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
528 ret=$?
529 if [ $ret -ne 0 ]; then
530 diff -u $testroot/stdout.expected $testroot/stdout
531 fi
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
551 ret=$?
552 if [ $ret -ne 0 ]; then
553 test_done "$testroot" "$ret"
554 return 1
555 fi
557 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
558 2> $testroot/stderr)
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
566 ret=$?
567 if [ $ret -ne 0 ]; then
568 diff -u $testroot/stdout.expected $testroot/stdout
569 test_done "$testroot" "$ret"
570 return 1
571 fi
573 echo "got: conflicts must be resolved before rebasing can continue" \
574 > $testroot/stderr.expected
575 cmp -s $testroot/stderr.expected $testroot/stderr
576 ret=$?
577 if [ $ret -ne 0 ]; then
578 diff -u $testroot/stderr.expected $testroot/stderr
579 test_done "$testroot" "$ret"
580 return 1
581 fi
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
594 ret=$?
595 if [ $ret -ne 0 ]; then
596 diff -u $testroot/content.expected $testroot/content
597 test_done "$testroot" "$ret"
598 return 1
599 fi
601 (cd $testroot/wt && got status > $testroot/stdout)
603 echo "C alpha" > $testroot/stdout.expected
604 cmp -s $testroot/stdout.expected $testroot/stdout
605 ret=$?
606 if [ $ret -ne 0 ]; then
607 diff -u $testroot/stdout.expected $testroot/stdout
608 test_done "$testroot" "$ret"
609 return 1
610 fi
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
627 ret=$?
628 if [ $ret -ne 0 ]; then
629 diff -u $testroot/stdout.expected $testroot/stdout
630 test_done "$testroot" "$ret"
631 return 1
632 fi
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
640 ret=$?
641 if [ $ret -ne 0 ]; then
642 diff -u $testroot/stdout.expected $testroot/stdout
643 fi
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
663 ret=$?
664 if [ $ret -ne 0 ]; then
665 test_done "$testroot" "$ret"
666 return 1
667 fi
669 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
670 2> $testroot/stderr)
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
678 ret=$?
679 if [ $ret -ne 0 ]; then
680 diff -u $testroot/stdout.expected $testroot/stdout
681 test_done "$testroot" "$ret"
682 return 1
683 fi
685 echo "got: conflicts must be resolved before rebasing can continue" \
686 > $testroot/stderr.expected
687 cmp -s $testroot/stderr.expected $testroot/stderr
688 ret=$?
689 if [ $ret -ne 0 ]; then
690 diff -u $testroot/stderr.expected $testroot/stderr
691 test_done "$testroot" "$ret"
692 return 1
693 fi
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
706 ret=$?
707 if [ $ret -ne 0 ]; then
708 diff -u $testroot/content.expected $testroot/content
709 test_done "$testroot" "$ret"
710 return 1
711 fi
713 (cd $testroot/wt && got status > $testroot/stdout)
715 echo "C alpha" > $testroot/stdout.expected
716 cmp -s $testroot/stdout.expected $testroot/stdout
717 ret=$?
718 if [ $ret -ne 0 ]; then
719 diff -u $testroot/stdout.expected $testroot/stdout
720 test_done "$testroot" "$ret"
721 return 1
722 fi
724 for cmd in update commit; do
725 (cd $testroot/wt && got $cmd > $testroot/stdout \
726 2> $testroot/stderr)
728 echo -n > $testroot/stdout.expected
729 cmp -s $testroot/stdout.expected $testroot/stdout
730 ret=$?
731 if [ $ret -ne 0 ]; then
732 diff -u $testroot/stdout.expected $testroot/stdout
733 test_done "$testroot" "$ret"
734 return 1
735 fi
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
742 ret=$?
743 if [ $ret -ne 0 ]; then
744 diff -u $testroot/stderr.expected $testroot/stderr
745 test_done "$testroot" "$ret"
746 return 1
747 fi
748 done
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
769 ret=$?
770 if [ $ret -ne 0 ]; then
771 test_done "$testroot" "$ret"
772 return 1
773 fi
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
780 ret=$?
781 if [ $ret -ne 0 ]; then
782 diff -u $testroot/stdout.expected $testroot/stdout
783 test_done "$testroot" "$ret"
784 return 1
785 fi
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
791 ret=$?
792 if [ $ret -ne 0 ]; then
793 diff -u $testroot/stderr.expected $testroot/stderr
794 test_done "$testroot" "$ret"
795 return 1
796 fi
798 # rebase should succeed when using a complete work tree
799 got checkout $testroot/repo $testroot/wt2 > /dev/null
800 ret=$?
801 if [ $ret -ne 0 ]; then
802 test_done "$testroot" "$ret"
803 return 1
804 fi
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
825 ret=$?
826 if [ $ret -ne 0 ]; then
827 diff -u $testroot/stdout.expected $testroot/stdout
828 test_done "$testroot" "$ret"
829 return 1
830 fi
832 # the first work tree should remain usable
833 (cd $testroot/wt && got update -b master \
834 > $testroot/stdout 2> $testroot/stderr)
835 ret=$?
836 if [ $ret -ne 0 ]; then
837 echo "update failed unexpectedly" >&2
838 test_done "$testroot" "1"
839 return 1
840 fi
842 echo 'Already up-to-date' > $testroot/stdout.expected
843 cmp -s $testroot/stdout.expected $testroot/stdout
844 ret=$?
845 if [ $ret -ne 0 ]; then
846 diff -u $testroot/stdout.expected $testroot/stdout
847 fi
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
873 ret=$?
874 if [ $ret -ne 0 ]; then
875 test_done "$testroot" "$ret"
876 return 1
877 fi
879 (cd $testroot/wt && got rebase newbranch > /dev/null \
880 2> $testroot/stderr)
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
888 ret=$?
889 if [ $ret -ne 0 ]; then
890 diff -u $testroot/stderr.expected $testroot/stderr
891 test_done "$testroot" "$ret"
892 return 1
893 fi
895 (cd $testroot/wt && got log -c newbranch -l2 | grep -v ^date: \
896 > $testroot/log)
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
900 ret=$?
901 if [ $ret -ne 0 ]; then
902 diff -u $testroot/log.expected $testroot/log
903 fi
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
912 ret=$?
913 if [ $ret -ne 0 ]; then
914 test_done "$testroot" "$ret"
915 return 1
916 fi
918 (cd $testroot/wt && got branch -n newbranch)
920 echo "modified alpha on master" > $testroot/wt/alpha
921 (cd $testroot/wt && got commit -m 'test rebase_no_commits_to_rebase' \
922 > /dev/null)
923 (cd $testroot/wt && got update > /dev/null)
925 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
926 2> $testroot/stderr)
928 echo "got: no commits to rebase" > $testroot/stderr.expected
929 cmp -s $testroot/stderr.expected $testroot/stderr
930 ret=$?
931 if [ $ret -ne 0 ]; then
932 diff -u $testroot/stderr.expected $testroot/stderr
933 test_done "$testroot" "$ret"
934 return 1
935 fi
937 echo -n > $testroot/stdout.expected
938 cmp -s $testroot/stdout.expected $testroot/stdout
939 ret=$?
940 if [ $ret -ne 0 ]; then
941 diff -u $testroot/stdout.expected $testroot/stdout
942 test_done "$testroot" "$ret"
943 return 1
944 fi
946 (cd $testroot/wt && got update > $testroot/stdout)
947 echo "Already up-to-date" > $testroot/stdout.expected
948 cmp -s $testroot/stdout.expected $testroot/stdout
949 ret=$?
950 if [ $ret -ne 0 ]; then
951 diff -u $testroot/stdout.expected $testroot/stdout
952 fi
953 test_done "$testroot" "$ret"
956 test_rebase_forward() {
957 local testroot=`test_init rebase_forward`
958 local commit0=`git_show_head $testroot/repo`
960 got checkout $testroot/repo $testroot/wt > /dev/null
961 ret=$?
962 if [ $ret -ne 0 ]; then
963 test_done "$testroot" "$ret"
964 return 1
965 fi
967 echo "change alpha 1" > $testroot/wt/alpha
968 (cd $testroot/wt && got commit -m 'test rebase_forward' \
969 > /dev/null)
970 local commit1=`git_show_head $testroot/repo`
972 echo "change alpha 2" > $testroot/wt/alpha
973 (cd $testroot/wt && got commit -m 'test rebase_forward' \
974 > /dev/null)
975 local commit2=`git_show_head $testroot/repo`
977 # Simulate a situation where fast-forward is required.
978 # We want to fast-forward master to origin/master:
979 # commit 3907e11dceaae2ca7f8db79c2af31794673945ad (origin/master)
980 # commit ffcffcd102cf1af6572fbdbb4cf07a0f1fd2d840 (master)
981 # commit 87a6a8a2263a15b61c016ff1720b24741d455eb5
982 (cd $testroot/repo && got ref -d master >/dev/null)
983 (cd $testroot/repo && got ref -c $commit1 refs/heads/master)
984 (cd $testroot/repo && got ref -c $commit2 refs/remotes/origin/master)
986 (cd $testroot/wt && got up -b origin/master > /dev/null)
988 (cd $testroot/wt && got rebase master \
989 > $testroot/stdout 2> $testroot/stderr)
991 echo "Forwarding refs/heads/master to commit $commit2" \
992 > $testroot/stdout.expected
993 echo "Switching work tree to refs/heads/master" \
994 >> $testroot/stdout.expected
995 cmp -s $testroot/stdout.expected $testroot/stdout
996 ret=$?
997 if [ $ret -ne 0 ]; then
998 diff -u $testroot/stdout.expected $testroot/stdout
999 test_done "$testroot" "$ret"
1000 return 1
1003 # Ensure that rebase operation was completed correctly
1004 (cd $testroot/wt && got rebase -a \
1005 > $testroot/stdout 2> $testroot/stderr)
1006 echo -n "" > $testroot/stdout.expected
1007 cmp -s $testroot/stdout.expected $testroot/stdout
1008 ret=$?
1009 if [ $ret -ne 0 ]; then
1010 diff -u $testroot/stdout.expected $testroot/stdout
1011 test_done "$testroot" "$ret"
1012 return 1
1014 echo "got: rebase operation not in progress" > $testroot/stderr.expected
1015 cmp -s $testroot/stderr.expected $testroot/stderr
1016 ret=$?
1017 if [ $ret -ne 0 ]; then
1018 diff -u $testroot/stderr.expected $testroot/stderr
1019 test_done "$testroot" "$ret"
1020 return 1
1023 (cd $testroot/wt && got branch -n > $testroot/stdout)
1024 echo "master" > $testroot/stdout.expected
1025 cmp -s $testroot/stdout.expected $testroot/stdout
1026 ret=$?
1027 if [ $ret -ne 0 ]; then
1028 diff -u $testroot/stdout.expected $testroot/stdout
1029 test_done "$testroot" "$ret"
1030 return 1
1033 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1034 echo "commit $commit2 (master, origin/master)" > $testroot/stdout.expected
1035 echo "commit $commit1" >> $testroot/stdout.expected
1036 echo "commit $commit0" >> $testroot/stdout.expected
1037 cmp -s $testroot/stdout.expected $testroot/stdout
1038 ret=$?
1039 if [ $ret -ne 0 ]; then
1040 diff -u $testroot/stdout.expected $testroot/stdout
1041 test_done "$testroot" "$ret"
1042 return 1
1045 # Forward-only rebase operations should not be backed up
1046 (cd $testroot/repo && got rebase -l > $testroot/stdout)
1047 echo -n > $testroot/stdout.expected
1048 cmp -s $testroot/stdout.expected $testroot/stdout
1049 ret=$?
1050 if [ $ret -ne 0 ]; then
1051 diff -u $testroot/stdout.expected $testroot/stdout
1053 test_done "$testroot" "$ret"
1056 test_rebase_forward_path_prefix() {
1057 local testroot=`test_init rebase_forward_path_prefix`
1058 local commit0=`git_show_head $testroot/repo`
1060 got checkout $testroot/repo $testroot/wt-full > /dev/null
1061 ret=$?
1062 if [ $ret -ne 0 ]; then
1063 test_done "$testroot" "$ret"
1064 return 1
1067 echo "change alpha 1" > $testroot/wt-full/alpha
1068 (cd $testroot/wt-full && got commit -m 'test rebase_forward' \
1069 > /dev/null)
1070 local commit1=`git_show_head $testroot/repo`
1072 echo "change alpha 2" > $testroot/wt-full/alpha
1073 (cd $testroot/wt-full && got commit -m 'test rebase_forward' \
1074 > /dev/null)
1075 local commit2=`git_show_head $testroot/repo`
1077 # Simulate a situation where fast-forward is required.
1078 # We want to fast-forward master to origin/master:
1079 # commit 3907e11dceaae2ca7f8db79c2af31794673945ad (origin/master)
1080 # commit ffcffcd102cf1af6572fbdbb4cf07a0f1fd2d840 (master)
1081 # commit 87a6a8a2263a15b61c016ff1720b24741d455eb5
1082 (cd $testroot/repo && got ref -d master >/dev/null)
1083 (cd $testroot/repo && got ref -c $commit1 refs/heads/master)
1084 (cd $testroot/repo && got ref -c $commit2 refs/remotes/origin/master)
1086 # Work tree which uses a path-prefix and will be used for rebasing
1087 got checkout -p epsilon -b origin/master $testroot/repo $testroot/wt \
1088 > /dev/null
1089 ret=$?
1090 if [ $ret -ne 0 ]; then
1091 test_done "$testroot" "$ret"
1092 return 1
1095 (cd $testroot/wt && /usr/local/bin/got rebase master \
1096 > $testroot/stdout 2> $testroot/stderr)
1098 echo "Forwarding refs/heads/master to commit $commit2" \
1099 > $testroot/stdout.expected
1100 echo "Switching work tree to refs/heads/master" \
1101 >> $testroot/stdout.expected
1102 cmp -s $testroot/stdout.expected $testroot/stdout
1103 ret=$?
1104 if [ $ret -ne 0 ]; then
1105 diff -u $testroot/stdout.expected $testroot/stdout
1106 test_done "$testroot" "$ret"
1107 return 1
1110 # Ensure that rebase operation was completed correctly
1111 (cd $testroot/wt && got rebase -a \
1112 > $testroot/stdout 2> $testroot/stderr)
1113 echo -n "" > $testroot/stdout.expected
1114 cmp -s $testroot/stdout.expected $testroot/stdout
1115 ret=$?
1116 if [ $ret -ne 0 ]; then
1117 diff -u $testroot/stdout.expected $testroot/stdout
1118 test_done "$testroot" "$ret"
1119 return 1
1121 echo "got: rebase operation not in progress" > $testroot/stderr.expected
1122 cmp -s $testroot/stderr.expected $testroot/stderr
1123 ret=$?
1124 if [ $ret -ne 0 ]; then
1125 diff -u $testroot/stderr.expected $testroot/stderr
1126 test_done "$testroot" "$ret"
1127 return 1
1130 (cd $testroot/wt && got branch -n > $testroot/stdout)
1131 echo "master" > $testroot/stdout.expected
1132 cmp -s $testroot/stdout.expected $testroot/stdout
1133 ret=$?
1134 if [ $ret -ne 0 ]; then
1135 diff -u $testroot/stdout.expected $testroot/stdout
1136 test_done "$testroot" "$ret"
1137 return 1
1140 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1141 echo "commit $commit2 (master, origin/master)" > $testroot/stdout.expected
1142 echo "commit $commit1" >> $testroot/stdout.expected
1143 echo "commit $commit0" >> $testroot/stdout.expected
1144 cmp -s $testroot/stdout.expected $testroot/stdout
1145 ret=$?
1146 if [ $ret -ne 0 ]; then
1147 diff -u $testroot/stdout.expected $testroot/stdout
1148 test_done "$testroot" "$ret"
1149 return 1
1152 # Forward-only rebase operations should not be backed up
1153 (cd $testroot/repo && got rebase -l > $testroot/stdout)
1154 echo -n > $testroot/stdout.expected
1155 cmp -s $testroot/stdout.expected $testroot/stdout
1156 ret=$?
1157 if [ $ret -ne 0 ]; then
1158 diff -u $testroot/stdout.expected $testroot/stdout
1160 test_done "$testroot" "$ret"
1163 test_rebase_out_of_date() {
1164 local testroot=`test_init rebase_out_of_date`
1165 local initial_commit=`git_show_head $testroot/repo`
1167 (cd $testroot/repo && git checkout -q -b newbranch)
1168 echo "modified delta on branch" > $testroot/repo/gamma/delta
1169 git_commit $testroot/repo -m "committing to delta on newbranch"
1171 echo "modified alpha on branch" > $testroot/repo/alpha
1172 (cd $testroot/repo && git rm -q beta)
1173 echo "new file on branch" > $testroot/repo/epsilon/new
1174 (cd $testroot/repo && git add epsilon/new)
1175 git_commit $testroot/repo -m "committing more changes on newbranch"
1177 local orig_commit1=`git_show_parent_commit $testroot/repo`
1178 local orig_commit2=`git_show_head $testroot/repo`
1180 (cd $testroot/repo && git checkout -q master)
1181 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1182 git_commit $testroot/repo -m "committing to zeta on master"
1183 local master_commit1=`git_show_head $testroot/repo`
1185 (cd $testroot/repo && git checkout -q master)
1186 echo "modified beta on master" > $testroot/repo/beta
1187 git_commit $testroot/repo -m "committing to beta on master"
1188 local master_commit2=`git_show_head $testroot/repo`
1190 got checkout -c $master_commit1 $testroot/repo $testroot/wt \
1191 > /dev/null
1192 ret=$?
1193 if [ $ret -ne 0 ]; then
1194 test_done "$testroot" "$ret"
1195 return 1
1198 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
1199 2> $testroot/stderr)
1201 echo -n > $testroot/stdout.expected
1202 cmp -s $testroot/stdout.expected $testroot/stdout
1203 ret=$?
1204 if [ $ret -ne 0 ]; then
1205 diff -u $testroot/stdout.expected $testroot/stdout
1206 test_done "$testroot" "$ret"
1207 return 1
1210 echo -n "got: work tree must be updated before it can be " \
1211 > $testroot/stderr.expected
1212 echo "used to rebase a branch" >> $testroot/stderr.expected
1213 cmp -s $testroot/stderr.expected $testroot/stderr
1214 ret=$?
1215 if [ $ret -ne 0 ]; then
1216 diff -u $testroot/stderr.expected $testroot/stderr
1217 test_done "$testroot" "$ret"
1218 return 1
1221 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1222 echo "commit $master_commit2 (master)" > $testroot/stdout.expected
1223 echo "commit $master_commit1" >> $testroot/stdout.expected
1224 echo "commit $initial_commit" >> $testroot/stdout.expected
1225 cmp -s $testroot/stdout.expected $testroot/stdout
1226 ret=$?
1227 if [ $ret -ne 0 ]; then
1228 diff -u $testroot/stdout.expected $testroot/stdout
1230 test_done "$testroot" "$ret"
1233 test_rebase_trims_empty_dir() {
1234 local testroot=`test_init rebase_trims_empty_dir`
1236 (cd $testroot/repo && git checkout -q -b newbranch)
1237 echo "modified delta on branch" > $testroot/repo/gamma/delta
1238 git_commit $testroot/repo -m "committing to delta on newbranch"
1240 (cd $testroot/repo && git rm -q epsilon/zeta)
1241 git_commit $testroot/repo -m "removing zeta on newbranch"
1243 local orig_commit1=`git_show_parent_commit $testroot/repo`
1244 local orig_commit2=`git_show_head $testroot/repo`
1246 (cd $testroot/repo && git checkout -q master)
1247 echo "modified alpha on master" > $testroot/repo/alpha
1248 git_commit $testroot/repo -m "committing to alpha on master"
1249 local master_commit=`git_show_head $testroot/repo`
1251 got checkout $testroot/repo $testroot/wt > /dev/null
1252 ret=$?
1253 if [ $ret -ne 0 ]; then
1254 test_done "$testroot" "$ret"
1255 return 1
1258 (cd $testroot/wt && got rebase newbranch > $testroot/stdout)
1260 (cd $testroot/repo && git checkout -q newbranch)
1261 local new_commit1=`git_show_parent_commit $testroot/repo`
1262 local new_commit2=`git_show_head $testroot/repo`
1264 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1265 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1266 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1267 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1269 echo "G gamma/delta" >> $testroot/stdout.expected
1270 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1271 >> $testroot/stdout.expected
1272 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1273 echo "D epsilon/zeta" >> $testroot/stdout.expected
1274 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1275 >> $testroot/stdout.expected
1276 echo ": removing zeta on newbranch" \
1277 >> $testroot/stdout.expected
1278 echo "Switching work tree to refs/heads/newbranch" \
1279 >> $testroot/stdout.expected
1281 cmp -s $testroot/stdout.expected $testroot/stdout
1282 ret=$?
1283 if [ $ret -ne 0 ]; then
1284 diff -u $testroot/stdout.expected $testroot/stdout
1285 test_done "$testroot" "$ret"
1286 return 1
1289 echo "modified delta on branch" > $testroot/content.expected
1290 cat $testroot/wt/gamma/delta > $testroot/content
1291 cmp -s $testroot/content.expected $testroot/content
1292 ret=$?
1293 if [ $ret -ne 0 ]; then
1294 diff -u $testroot/content.expected $testroot/content
1295 test_done "$testroot" "$ret"
1296 return 1
1299 echo "modified alpha on master" > $testroot/content.expected
1300 cat $testroot/wt/alpha > $testroot/content
1301 cmp -s $testroot/content.expected $testroot/content
1302 ret=$?
1303 if [ $ret -ne 0 ]; then
1304 diff -u $testroot/content.expected $testroot/content
1305 test_done "$testroot" "$ret"
1306 return 1
1309 if [ -e $testroot/wt/epsilon ]; then
1310 echo "parent of removed zeta still exists on disk" >&2
1311 test_done "$testroot" "1"
1312 return 1
1315 (cd $testroot/wt && got status > $testroot/stdout)
1317 echo -n > $testroot/stdout.expected
1318 cmp -s $testroot/stdout.expected $testroot/stdout
1319 ret=$?
1320 if [ $ret -ne 0 ]; then
1321 diff -u $testroot/stdout.expected $testroot/stdout
1322 test_done "$testroot" "$ret"
1323 return 1
1326 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1327 echo "commit $new_commit2 (newbranch)" > $testroot/stdout.expected
1328 echo "commit $new_commit1" >> $testroot/stdout.expected
1329 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1330 cmp -s $testroot/stdout.expected $testroot/stdout
1331 ret=$?
1332 if [ $ret -ne 0 ]; then
1333 diff -u $testroot/stdout.expected $testroot/stdout
1335 test_done "$testroot" "$ret"
1338 test_rebase_delete_missing_file() {
1339 local testroot=`test_init rebase_delete_missing_file`
1341 mkdir -p $testroot/repo/d/f/g
1342 echo "new file" > $testroot/repo/d/f/g/new
1343 (cd $testroot/repo && git add d/f/g/new)
1344 git_commit $testroot/repo -m "adding a subdir"
1345 local commit0=`git_show_head $testroot/repo`
1347 got br -r $testroot/repo -c master newbranch
1349 got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
1351 echo "modified delta on branch" > $testroot/wt/gamma/delta
1352 (cd $testroot/wt && got commit \
1353 -m "committing to delta on newbranch" > /dev/null)
1355 (cd $testroot/wt && got rm beta d/f/g/new > /dev/null)
1356 (cd $testroot/wt && got commit \
1357 -m "removing beta and d/f/g/new on newbranch" > /dev/null)
1359 (cd $testroot/repo && git checkout -q newbranch)
1360 local orig_commit1=`git_show_parent_commit $testroot/repo`
1361 local orig_commit2=`git_show_head $testroot/repo`
1363 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1364 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1366 (cd $testroot/wt && got update -b master > /dev/null)
1367 (cd $testroot/wt && got rm beta d/f/g/new > /dev/null)
1368 (cd $testroot/wt && got commit \
1369 -m "removing beta and d/f/g/new on master" > /dev/null)
1371 (cd $testroot/repo && git checkout -q master)
1372 local master_commit=`git_show_head $testroot/repo`
1374 (cd $testroot/wt && got update -b master > /dev/null)
1375 (cd $testroot/wt && got rebase newbranch > $testroot/stdout \
1376 2> $testroot/stderr)
1377 ret=$?
1378 if [ $ret -eq 0 ]; then
1379 echo "rebase succeeded unexpectedly" >&2
1380 test_done "$testroot" "1"
1381 return 1
1384 local new_commit1=$(cd $testroot/wt && got info | \
1385 grep '^work tree base commit: ' | cut -d: -f2 | tr -d ' ')
1387 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1388 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1390 echo "G gamma/delta" >> $testroot/stdout.expected
1391 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1392 >> $testroot/stdout.expected
1393 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1394 echo "! beta" >> $testroot/stdout.expected
1395 echo "! d/f/g/new" >> $testroot/stdout.expected
1396 echo -n "Files which had incoming changes but could not be found " \
1397 >> $testroot/stdout.expected
1398 echo "in the work tree: 2" >> $testroot/stdout.expected
1399 cmp -s $testroot/stdout.expected $testroot/stdout
1400 ret=$?
1401 if [ $ret -ne 0 ]; then
1402 diff -u $testroot/stdout.expected $testroot/stdout
1403 test_done "$testroot" "$ret"
1404 return 1
1407 echo -n "got: changes destined for some files were not yet merged " \
1408 > $testroot/stderr.expected
1409 echo -n "and should be merged manually if required before the " \
1410 >> $testroot/stderr.expected
1411 echo "rebase operation is continued" >> $testroot/stderr.expected
1412 cmp -s $testroot/stderr.expected $testroot/stderr
1413 ret=$?
1414 if [ $ret -ne 0 ]; then
1415 diff -u $testroot/stderr.expected $testroot/stderr
1416 test_done "$testroot" "$ret"
1417 return 1
1420 # ignore the missing changes and continue
1421 (cd $testroot/wt && got rebase -c > $testroot/stdout)
1422 ret=$?
1423 if [ $ret -ne 0 ]; then
1424 echo "rebase failed unexpectedly" >&2
1425 test_done "$testroot" "1"
1426 return 1
1428 echo -n "$short_orig_commit2 -> no-op change" \
1429 > $testroot/stdout.expected
1430 echo ": removing beta and d/f/g/new on newbranch" \
1431 >> $testroot/stdout.expected
1432 echo "Switching work tree to refs/heads/newbranch" \
1433 >> $testroot/stdout.expected
1435 cmp -s $testroot/stdout.expected $testroot/stdout
1436 ret=$?
1437 if [ $ret -ne 0 ]; then
1438 diff -u $testroot/stdout.expected $testroot/stdout
1439 test_done "$testroot" "$ret"
1440 return 1
1443 echo "modified delta on branch" > $testroot/content.expected
1444 cat $testroot/wt/gamma/delta > $testroot/content
1445 cmp -s $testroot/content.expected $testroot/content
1446 ret=$?
1447 if [ $ret -ne 0 ]; then
1448 diff -u $testroot/content.expected $testroot/content
1449 test_done "$testroot" "$ret"
1450 return 1
1453 if [ -e $testroot/wt/beta ]; then
1454 echo "removed file beta still exists on disk" >&2
1455 test_done "$testroot" "1"
1456 return 1
1459 (cd $testroot/wt && got status > $testroot/stdout)
1461 echo -n > $testroot/stdout.expected
1462 cmp -s $testroot/stdout.expected $testroot/stdout
1463 ret=$?
1464 if [ $ret -ne 0 ]; then
1465 diff -u $testroot/stdout.expected $testroot/stdout
1466 test_done "$testroot" "$ret"
1467 return 1
1470 (cd $testroot/repo && git checkout -q newbranch)
1471 local new_commit1=`git_show_head $testroot/repo`
1472 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1474 (cd $testroot/wt && got log -l3 | grep ^commit > $testroot/stdout)
1475 echo "commit $new_commit1 (newbranch)" > $testroot/stdout.expected
1476 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1477 echo "commit $commit0" >> $testroot/stdout.expected
1478 cmp -s $testroot/stdout.expected $testroot/stdout
1479 ret=$?
1480 if [ $ret -ne 0 ]; then
1481 diff -u $testroot/stdout.expected $testroot/stdout
1483 test_done "$testroot" "$ret"
1486 test_rebase_rm_add_rm_file() {
1487 local testroot=`test_init rebase_rm_add_rm_file`
1489 (cd $testroot/repo && git checkout -q -b newbranch)
1490 (cd $testroot/repo && git rm -q beta)
1491 git_commit $testroot/repo -m "removing beta from newbranch"
1492 local orig_commit1=`git_show_head $testroot/repo`
1494 echo 'restored beta' > $testroot/repo/beta
1495 (cd $testroot/repo && git add beta)
1496 git_commit $testroot/repo -m "restoring beta on newbranch"
1497 local orig_commit2=`git_show_head $testroot/repo`
1499 (cd $testroot/repo && git rm -q beta)
1500 git_commit $testroot/repo -m "removing beta from newbranch again"
1501 local orig_commit3=`git_show_head $testroot/repo`
1503 (cd $testroot/repo && git checkout -q master)
1504 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1505 git_commit $testroot/repo -m "committing to zeta on master"
1506 local master_commit=`git_show_head $testroot/repo`
1508 got checkout $testroot/repo $testroot/wt > /dev/null
1509 ret=$?
1510 if [ $ret -ne 0 ]; then
1511 test_done "$testroot" "$ret"
1512 return 1
1515 (cd $testroot/wt && got rebase newbranch > $testroot/stdout)
1517 # this would error out with 'got: file index is corrupt'
1518 (cd $testroot/wt && got status > /dev/null)
1519 ret=$?
1520 if [ $ret -ne 0 ]; then
1521 echo "got status command failed unexpectedly" >&2
1522 test_done "$testroot" "$ret"
1523 return 1
1526 (cd $testroot/repo && git checkout -q newbranch)
1527 local new_commit3=`git_show_head $testroot/repo`
1528 local new_commit2=`git_show_parent_commit $testroot/repo`
1529 local new_commit1=`git_show_parent_commit $testroot/repo $new_commit2`
1531 (cd $testroot/repo && git checkout -q newbranch)
1533 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1534 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1535 local short_orig_commit3=`trim_obj_id 28 $orig_commit3`
1536 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1537 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1538 local short_new_commit3=`trim_obj_id 28 $new_commit3`
1540 echo "D beta" > $testroot/stdout.expected
1541 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1542 >> $testroot/stdout.expected
1543 echo ": removing beta from newbranch" >> $testroot/stdout.expected
1544 echo "A beta" >> $testroot/stdout.expected
1545 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1546 >> $testroot/stdout.expected
1547 echo ": restoring beta on newbranch" >> $testroot/stdout.expected
1548 echo "D beta" >> $testroot/stdout.expected
1549 echo -n "$short_orig_commit3 -> $short_new_commit3" \
1550 >> $testroot/stdout.expected
1551 echo ": removing beta from newbranch again" >> $testroot/stdout.expected
1552 echo "Switching work tree to refs/heads/newbranch" \
1553 >> $testroot/stdout.expected
1555 cmp -s $testroot/stdout.expected $testroot/stdout
1556 ret=$?
1557 if [ $ret -ne 0 ]; then
1558 diff -u $testroot/stdout.expected $testroot/stdout
1559 test_done "$testroot" "$ret"
1560 return 1
1563 (cd $testroot/wt && got status > $testroot/stdout)
1564 ret=$?
1565 if [ $ret -ne 0 ]; then
1566 echo "got status command failed unexpectedly" >&2
1567 test_done "$testroot" "$ret"
1568 return 1
1571 echo -n > $testroot/stdout.expected
1572 cmp -s $testroot/stdout.expected $testroot/stdout
1573 ret=$?
1574 if [ $ret -ne 0 ]; then
1575 diff -u $testroot/stdout.expected $testroot/stdout
1576 test_done "$testroot" "$ret"
1577 return 1
1580 (cd $testroot/wt && got log -l4 | grep ^commit > $testroot/stdout)
1581 echo "commit $new_commit3 (newbranch)" > $testroot/stdout.expected
1582 echo "commit $new_commit2" >> $testroot/stdout.expected
1583 echo "commit $new_commit1" >> $testroot/stdout.expected
1584 echo "commit $master_commit (master)" >> $testroot/stdout.expected
1585 cmp -s $testroot/stdout.expected $testroot/stdout
1586 ret=$?
1587 if [ $ret -ne 0 ]; then
1588 diff -u $testroot/stdout.expected $testroot/stdout
1590 test_done "$testroot" "$ret"
1593 test_rebase_resets_committer() {
1594 local testroot=`test_init rebase_resets_committer`
1595 local commit0=`git_show_head $testroot/repo`
1596 local commit0_author_time=`git_show_author_time $testroot/repo`
1597 local committer="Flan Luck <flan_luck@openbsd.org>"
1599 (cd $testroot/repo && git checkout -q -b newbranch)
1600 echo "modified delta on branch" > $testroot/repo/gamma/delta
1601 git_commit $testroot/repo -m "committing to delta on newbranch"
1603 echo "modified alpha on branch" > $testroot/repo/alpha
1604 git_commit $testroot/repo -m "committing more changes on newbranch"
1606 local orig_commit1=`git_show_parent_commit $testroot/repo`
1607 local orig_commit2=`git_show_head $testroot/repo`
1608 local orig_author_time2=`git_show_author_time $testroot/repo`
1610 (cd $testroot/repo && git checkout -q master)
1611 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1612 git_commit $testroot/repo -m "committing to zeta on master"
1613 local master_commit=`git_show_head $testroot/repo`
1615 got checkout $testroot/repo $testroot/wt > /dev/null
1616 ret=$?
1617 if [ $ret -ne 0 ]; then
1618 test_done "$testroot" "$ret"
1619 return 1
1622 (cd $testroot/wt && env GOT_AUTHOR="$committer" \
1623 got rebase newbranch > $testroot/stdout)
1625 (cd $testroot/repo && git checkout -q newbranch)
1626 local new_commit1=`git_show_parent_commit $testroot/repo`
1627 local new_commit2=`git_show_head $testroot/repo`
1628 local new_author_time2=`git_show_author_time $testroot/repo`
1630 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1631 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1632 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1633 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1635 echo "G gamma/delta" >> $testroot/stdout.expected
1636 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1637 >> $testroot/stdout.expected
1638 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1639 echo "G alpha" >> $testroot/stdout.expected
1640 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1641 >> $testroot/stdout.expected
1642 echo ": committing more changes on newbranch" \
1643 >> $testroot/stdout.expected
1644 echo "Switching work tree to refs/heads/newbranch" \
1645 >> $testroot/stdout.expected
1647 cmp -s $testroot/stdout.expected $testroot/stdout
1648 ret=$?
1649 if [ $ret -ne 0 ]; then
1650 diff -u $testroot/stdout.expected $testroot/stdout
1651 test_done "$testroot" "$ret"
1652 return 1
1655 # Original commit only had one author
1656 (cd $testroot/repo && got log -l1 -c $orig_commit2 | \
1657 egrep '^(from|via):' > $testroot/stdout)
1658 echo "from: $GOT_AUTHOR" > $testroot/stdout.expected
1659 cmp -s $testroot/stdout.expected $testroot/stdout
1660 ret=$?
1661 if [ $ret -ne 0 ]; then
1662 diff -u $testroot/stdout.expected $testroot/stdout
1663 test_done "$testroot" "$ret"
1664 return 1
1667 # Rebased commit should have new committer name added
1668 (cd $testroot/repo && got log -l1 -c $new_commit2 | \
1669 egrep '^(from|via):' > $testroot/stdout)
1670 echo "from: $GOT_AUTHOR" > $testroot/stdout.expected
1671 echo "via: $committer" >> $testroot/stdout.expected
1673 cmp -s $testroot/stdout.expected $testroot/stdout
1674 ret=$?
1675 if [ $ret -ne 0 ]; then
1676 diff -u $testroot/stdout.expected $testroot/stdout
1678 test_done "$testroot" "$ret"
1681 test_rebase_no_author_info() {
1682 local testroot=`test_init rebase_no_author_info`
1683 local commit0=`git_show_head $testroot/repo`
1684 local commit0_author_time=`git_show_author_time $testroot/repo`
1685 local committer="$GOT_AUTHOR"
1687 (cd $testroot/repo && git checkout -q -b newbranch)
1688 echo "modified delta on branch" > $testroot/repo/gamma/delta
1689 git_commit $testroot/repo -m "committing to delta on newbranch"
1691 echo "modified alpha on branch" > $testroot/repo/alpha
1692 git_commit $testroot/repo -m "committing more changes on newbranch"
1694 local orig_commit1=`git_show_parent_commit $testroot/repo`
1695 local orig_commit2=`git_show_head $testroot/repo`
1696 local orig_author_time2=`git_show_author_time $testroot/repo`
1698 (cd $testroot/repo && git checkout -q master)
1699 echo "modified zeta on master" > $testroot/repo/epsilon/zeta
1700 git_commit $testroot/repo -m "committing to zeta on master"
1701 local master_commit=`git_show_head $testroot/repo`
1703 got checkout $testroot/repo $testroot/wt > /dev/null
1704 ret=$?
1705 if [ $ret -ne 0 ]; then
1706 test_done "$testroot" "$ret"
1707 return 1
1710 # unset in a subshell to avoid affecting our environment
1711 (unset GOT_AUTHOR && cd $testroot/wt && \
1712 got rebase newbranch > $testroot/stdout)
1714 (cd $testroot/repo && git checkout -q newbranch)
1715 local new_commit1=`git_show_parent_commit $testroot/repo`
1716 local new_commit2=`git_show_head $testroot/repo`
1717 local new_author_time2=`git_show_author_time $testroot/repo`
1719 local short_orig_commit1=`trim_obj_id 28 $orig_commit1`
1720 local short_orig_commit2=`trim_obj_id 28 $orig_commit2`
1721 local short_new_commit1=`trim_obj_id 28 $new_commit1`
1722 local short_new_commit2=`trim_obj_id 28 $new_commit2`
1724 echo "G gamma/delta" >> $testroot/stdout.expected
1725 echo -n "$short_orig_commit1 -> $short_new_commit1" \
1726 >> $testroot/stdout.expected
1727 echo ": committing to delta on newbranch" >> $testroot/stdout.expected
1728 echo "G alpha" >> $testroot/stdout.expected
1729 echo -n "$short_orig_commit2 -> $short_new_commit2" \
1730 >> $testroot/stdout.expected
1731 echo ": committing more changes on newbranch" \
1732 >> $testroot/stdout.expected
1733 echo "Switching work tree to refs/heads/newbranch" \
1734 >> $testroot/stdout.expected
1736 cmp -s $testroot/stdout.expected $testroot/stdout
1737 ret=$?
1738 if [ $ret -ne 0 ]; then
1739 diff -u $testroot/stdout.expected $testroot/stdout
1740 test_done "$testroot" "$ret"
1741 return 1
1744 # Original commit only had one author
1745 (cd $testroot/repo && got log -l1 -c $orig_commit2 | \
1746 egrep '^(from|via):' > $testroot/stdout)
1747 echo "from: $committer" > $testroot/stdout.expected
1748 cmp -s $testroot/stdout.expected $testroot/stdout
1749 ret=$?
1750 if [ $ret -ne 0 ]; then
1751 diff -u $testroot/stdout.expected $testroot/stdout
1752 test_done "$testroot" "$ret"
1753 return 1
1756 # Author info of rebased commit should match the original
1757 (cd $testroot/repo && got log -l1 -c $new_commit2 | \
1758 egrep '^(from|via):' > $testroot/stdout)
1759 echo "from: $committer" > $testroot/stdout.expected
1761 cmp -s $testroot/stdout.expected $testroot/stdout
1762 ret=$?
1763 if [ $ret -ne 0 ]; then
1764 diff -u $testroot/stdout.expected $testroot/stdout
1766 test_done "$testroot" "$ret"
1769 test_rebase_nonbranch() {
1770 local testroot=`test_init rebase_nonbranch`
1772 got ref -r $testroot/repo -c refs/heads/master \
1773 refs/remotes/origin/master >/dev/null
1775 got checkout -b master $testroot/repo $testroot/wt >/dev/null
1777 (cd $testroot/wt && got rebase origin/master > $testroot/stdout \
1778 2> $testroot/stderr)
1779 ret=$?
1780 if [ $ret -eq 0 ]; then
1781 echo "rebase succeeded unexpectedly" >&2
1782 test_done "$testroot" "1"
1783 return 1
1785 echo -n "got: will not rebase a branch which lives outside the " \
1786 > $testroot/stderr.expected
1787 echo '"refs/heads/" reference namespace' >> $testroot/stderr.expected
1788 cmp -s $testroot/stderr.expected $testroot/stderr
1789 ret=$?
1790 if [ $ret -ne 0 ]; then
1791 diff -u $testroot/stderr.expected $testroot/stderr
1793 test_done "$testroot" "$ret"
1796 test_parseargs "$@"
1797 run_test test_rebase_basic
1798 run_test test_rebase_ancestry_check
1799 run_test test_rebase_continue
1800 run_test test_rebase_abort
1801 run_test test_rebase_no_op_change
1802 run_test test_rebase_in_progress
1803 run_test test_rebase_path_prefix
1804 run_test test_rebase_preserves_logmsg
1805 run_test test_rebase_no_commits_to_rebase
1806 run_test test_rebase_forward
1807 run_test test_rebase_forward_path_prefix
1808 run_test test_rebase_out_of_date
1809 run_test test_rebase_trims_empty_dir
1810 run_test test_rebase_delete_missing_file
1811 run_test test_rebase_rm_add_rm_file
1812 run_test test_rebase_resets_committer
1813 run_test test_rebase_no_author_info
1814 run_test test_rebase_nonbranch