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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Jun 28, 2019 at 22:59 UTC
0795aed0a09deea5a6a51c08465f6703015871a7
1 file changed
+16
-15
t/t6030-bisect-porcelain.sh
+16
-15
@@ -615,6 +615,7 @@ test_expect_success 'broken branch creation' '
615
git add missing/MISSING &&
616
git commit -m "6(broken): Added file that will be deleted" &&
617
git tag BROKEN_HASH6 &&
618
+ deleted=$(git rev-parse --verify HEAD:missing) &&
619
add_line_into_file "7(broken): second line on a broken branch" hello2 &&
620
git tag BROKEN_HASH7 &&
621
add_line_into_file "8(broken): third line on a broken branch" hello2 &&
@@ -622,12 +623,12 @@ test_expect_success 'broken branch creation' '
623
git rm missing/MISSING &&
624
git commit -m "9(broken): Remove missing file" &&
625
git tag BROKEN_HASH9 &&
625
- rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
626
+ rm .git/objects/$(test_oid_to_path $deleted)
627
'
628
629
echo "" > expected.ok
630
cat > expected.missing-tree.default <<EOF
630
-fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d
631
+fatal: unable to read tree $deleted
632
EOF
633
634
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' "
714
"
715
716
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>.
723
EOF
724
725
test_expect_success 'bisect log: successful result' '
@@ -731,14 +732,14 @@ test_expect_success 'bisect log: successful result' '
732
'
733
734
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
740
# 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>.
743
EOF
744
745
test_expect_success 'bisect log: only skip commits left' '