t6030: test bisecting with paths
This patch adds some tests to check that "git bisect" works fine when passing paths to "git bisect start" to reduce the number of bisection steps. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Mar 29, 2009 at 11:45 UTC
b74d7efb108c9d3fd2d057b0c452583552a0577a
1 file changed
+60
t/t6030-bisect-porcelain.sh
+60
@@ -506,6 +506,66 @@ test_expect_success 'optimized merge base checks' '
506
unset GIT_TRACE
507
'
508
509
+# This creates another side branch called "parallel" with some files
510
+# in some directories, to test bisecting with paths.
511
+#
512
+# We should have the following:
513
+#
514
+# P1-P2-P3-P4-P5-P6-P7
515
+# / / /
516
+# H1-H2-H3-H4-H5-H6-H7
517
+# \ \ \
518
+# S5-A \
519
+# \ \
520
+# S6-S7----B
521
+#
522
+test_expect_success '"parallel" side branch creation' '
523
+ git bisect reset &&
524
+ git checkout -b parallel $HASH1 &&
525
+ mkdir dir1 dir2 &&
526
+ add_line_into_file "1(para): line 1 on parallel branch" dir1/file1 &&
527
+ PARA_HASH1=$(git rev-parse --verify HEAD) &&
528
+ add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&
529
+ PARA_HASH2=$(git rev-parse --verify HEAD) &&
530
+ add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&
531
+ PARA_HASH3=$(git rev-parse --verify HEAD)
532
+ git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&
533
+ PARA_HASH4=$(git rev-parse --verify HEAD)
534
+ add_line_into_file "5(para): add line on parallel branch" dir1/file1 &&
535
+ PARA_HASH5=$(git rev-parse --verify HEAD)
536
+ add_line_into_file "6(para): add line on parallel branch" dir2/file2 &&
537
+ PARA_HASH6=$(git rev-parse --verify HEAD)
538
+ git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&
539
+ PARA_HASH7=$(git rev-parse --verify HEAD)
540
+'
541
+
542
+test_expect_success 'restricting bisection on one dir' '
543
+ git bisect reset &&
544
+ git bisect start HEAD $HASH1 -- dir1 &&
545
+ para1=$(git rev-parse --verify HEAD) &&
546
+ test "$para1" = "$PARA_HASH1" &&
547
+ git bisect bad > my_bisect_log.txt &&
548
+ grep "$PARA_HASH1 is first bad commit" my_bisect_log.txt
549
+'
550
+
551
+test_expect_success 'restricting bisection on one dir and a file' '
552
+ git bisect reset &&
553
+ git bisect start HEAD $HASH1 -- dir1 hello &&
554
+ para4=$(git rev-parse --verify HEAD) &&
555
+ test "$para4" = "$PARA_HASH4" &&
556
+ git bisect bad &&
557
+ hash3=$(git rev-parse --verify HEAD) &&
558
+ test "$hash3" = "$HASH3" &&
559
+ git bisect good &&
560
+ hash4=$(git rev-parse --verify HEAD) &&
561
+ test "$hash4" = "$HASH4" &&
562
+ git bisect good &&
563
+ para1=$(git rev-parse --verify HEAD) &&
564
+ test "$para1" = "$PARA_HASH1" &&
565
+ git bisect good > my_bisect_log.txt &&
566
+ grep "$PARA_HASH4 is first bad commit" my_bisect_log.txt
567
+'
568
+
569
#
570
#
571
test_done