@@ -904,4 +904,67 @@ test_expect_success 'pending objects are repacked appropriately' '
904904 )
905905'
906906
907+ test_expect_success ' check one .promisor file content after repack' '
908+ test_when_finished rm -rf prom_test &&
909+ git init prom_test &&
910+ path=prom_test/.git/objects/pack &&
911+
912+ (
913+ test_commit_bulk -C prom_test --start=1 1 &&
914+
915+ # Simulate .promisor file by creating it manually
916+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
917+ oid=$(git -C prom_test rev-parse HEAD) &&
918+ echo "$oid ref" >$prom &&
919+
920+ # Save the current .promisor content, repack, and check if correct
921+ prom_before_repack=$(cat $prom) &&
922+ git -C prom_test repack -a -d &&
923+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
924+ # $prom should contain "$prom_before_repack <date>"
925+ test_grep "$prom_before_repack " $prom &&
926+
927+ # Save the current .promisor content, repack, and check if correct
928+ cat $prom >prom_before_repack &&
929+ git -C prom_test repack -a -d &&
930+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
931+ # $prom should be exactly the same as prom_before_repack
932+ test_cmp prom_before_repack $prom
933+ )
934+ '
935+
936+ test_expect_success ' check multiple .promisor file content after repack' '
937+ test_when_finished rm -rf prom_test &&
938+ git init prom_test &&
939+ path=prom_test/.git/objects/pack &&
940+
941+ (
942+ # Create 2 packs and simulate .promisor files by creating them manually
943+ test_commit_bulk -C prom_test --start=1 1 &&
944+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
945+ oid=$(git -C prom_test rev-parse HEAD) &&
946+ echo "$oid ref" >$prom &&
947+ prom_before_repack1=$(cat $prom) &&
948+ test_commit_bulk -C prom_test --start=1 1 &&
949+ prom=$(ls -t $path/*.pack | head -n 1 | sed "s/\.pack/.promisor/") &&
950+ oid=$(git -C prom_test rev-parse HEAD) &&
951+ echo "$oid ref" >$prom &&
952+ prom_before_repack2=$(cat $prom) &&
953+
954+ # Repack, and check if correct compared to previous saved .promisor content
955+ git -C prom_test repack -a -d &&
956+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
957+ # $prom should contain "$prom_before_repack1 <date>" & "$prom_before_repack2 <date>"
958+ test_grep "$prom_before_repack1 " $prom &&
959+ test_grep "$prom_before_repack2 " $prom &&
960+
961+ # Save the current .promisor content, repack, and check if correct
962+ cat $prom >prom_before_repack &&
963+ git -C prom_test repack -a -d &&
964+ prom=$(ls $path/*.pack | sed "s/\.pack/.promisor/") &&
965+ # $prom should be exactly the same as prom_before_repack
966+ test_cmp prom_before_repack $prom
967+ )
968+ '
969+
907970test_done
0 commit comments