Skip to content

Commit 0795aed

Browse files
bk2204gitster
authored andcommitted
t6030: make test work with SHA-256
Compute several object ID values instead of hard-coding them, and use test_oid_to_path to cleanly produce a path for an object. Note that the bisect code which is tested here remains sensitive to the hash algorithm in use because it uses the object ID to disambiguate between two equidistant commits. Fortunately, SHA-1 and SHA-256 disambiguate identically in the cases we care about, so there is no need to modify the test to accommodate this situation. However, if a further hash algorithm change occurs, this test may require some restructuring. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b78a1b commit 0795aed

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

t/t6030-bisect-porcelain.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -615,19 +615,20 @@ test_expect_success 'broken branch creation' '
615615
git add missing/MISSING &&
616616
git commit -m "6(broken): Added file that will be deleted" &&
617617
git tag BROKEN_HASH6 &&
618+
deleted=$(git rev-parse --verify HEAD:missing) &&
618619
add_line_into_file "7(broken): second line on a broken branch" hello2 &&
619620
git tag BROKEN_HASH7 &&
620621
add_line_into_file "8(broken): third line on a broken branch" hello2 &&
621622
git tag BROKEN_HASH8 &&
622623
git rm missing/MISSING &&
623624
git commit -m "9(broken): Remove missing file" &&
624625
git tag BROKEN_HASH9 &&
625-
rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
626+
rm .git/objects/$(test_oid_to_path $deleted)
626627
'
627628

628629
echo "" > expected.ok
629630
cat > expected.missing-tree.default <<EOF
630-
fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d
631+
fatal: unable to read tree $deleted
631632
EOF
632633

633634
test_expect_success 'bisect fails if tree is broken on start commit' '
@@ -713,12 +714,12 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
713714
"
714715

715716
cat > expected.bisect-log <<EOF
716-
# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
717-
# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.
718-
git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f'
719-
# good: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
720-
git bisect good 3de952f2416b6084f557ec417709eac740c6818c
721-
# first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
717+
# bad: [$HASH4] Add <4: Ciao for now> into <hello>.
718+
# good: [$HASH2] Add <2: A new day for git> into <hello>.
719+
git bisect start '$HASH4' '$HASH2'
720+
# good: [$HASH3] Add <3: Another new day for git> into <hello>.
721+
git bisect good $HASH3
722+
# first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
722723
EOF
723724

724725
test_expect_success 'bisect log: successful result' '
@@ -731,14 +732,14 @@ test_expect_success 'bisect log: successful result' '
731732
'
732733

733734
cat > expected.bisect-skip-log <<EOF
734-
# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
735-
# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.
736-
git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f'
737-
# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
738-
git bisect skip 3de952f2416b6084f557ec417709eac740c6818c
735+
# bad: [$HASH4] Add <4: Ciao for now> into <hello>.
736+
# good: [$HASH2] Add <2: A new day for git> into <hello>.
737+
git bisect start '$HASH4' '$HASH2'
738+
# skip: [$HASH3] Add <3: Another new day for git> into <hello>.
739+
git bisect skip $HASH3
739740
# only skipped commits left to test
740-
# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
741-
# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
741+
# possible first bad commit: [$HASH4] Add <4: Ciao for now> into <hello>.
742+
# possible first bad commit: [$HASH3] Add <3: Another new day for git> into <hello>.
742743
EOF
743744

744745
test_expect_success 'bisect log: only skip commits left' '

0 commit comments

Comments
 (0)