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>
This commit is contained in:
Christian Couder 2009-03-29 11:45:01 +02:00 committed by Junio C Hamano
parent 23b5f18b50
commit b74d7efb10

View file

@ -506,6 +506,66 @@ test_expect_success 'optimized merge base checks' '
unset GIT_TRACE
'
# This creates another side branch called "parallel" with some files
# in some directories, to test bisecting with paths.
#
# We should have the following:
#
# P1-P2-P3-P4-P5-P6-P7
# / / /
# H1-H2-H3-H4-H5-H6-H7
# \ \ \
# S5-A \
# \ \
# S6-S7----B
#
test_expect_success '"parallel" side branch creation' '
git bisect reset &&
git checkout -b parallel $HASH1 &&
mkdir dir1 dir2 &&
add_line_into_file "1(para): line 1 on parallel branch" dir1/file1 &&
PARA_HASH1=$(git rev-parse --verify HEAD) &&
add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 &&
PARA_HASH2=$(git rev-parse --verify HEAD) &&
add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 &&
PARA_HASH3=$(git rev-parse --verify HEAD)
git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" &&
PARA_HASH4=$(git rev-parse --verify HEAD)
add_line_into_file "5(para): add line on parallel branch" dir1/file1 &&
PARA_HASH5=$(git rev-parse --verify HEAD)
add_line_into_file "6(para): add line on parallel branch" dir2/file2 &&
PARA_HASH6=$(git rev-parse --verify HEAD)
git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" &&
PARA_HASH7=$(git rev-parse --verify HEAD)
'
test_expect_success 'restricting bisection on one dir' '
git bisect reset &&
git bisect start HEAD $HASH1 -- dir1 &&
para1=$(git rev-parse --verify HEAD) &&
test "$para1" = "$PARA_HASH1" &&
git bisect bad > my_bisect_log.txt &&
grep "$PARA_HASH1 is first bad commit" my_bisect_log.txt
'
test_expect_success 'restricting bisection on one dir and a file' '
git bisect reset &&
git bisect start HEAD $HASH1 -- dir1 hello &&
para4=$(git rev-parse --verify HEAD) &&
test "$para4" = "$PARA_HASH4" &&
git bisect bad &&
hash3=$(git rev-parse --verify HEAD) &&
test "$hash3" = "$HASH3" &&
git bisect good &&
hash4=$(git rev-parse --verify HEAD) &&
test "$hash4" = "$HASH4" &&
git bisect good &&
para1=$(git rev-parse --verify HEAD) &&
test "$para1" = "$PARA_HASH1" &&
git bisect good > my_bisect_log.txt &&
grep "$PARA_HASH4 is first bad commit" my_bisect_log.txt
'
#
#
test_done