Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions find_bisect_testcases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
#
# Find test cases candidates when bisect goes through
# many merge cases

NB_COMMITS="$1"

COUNT_LOG="my_count_log.txt"
SCRIPT_DIR="$(pwd)"

touch "$COUNT_LOG"

while :
do
randnum=$(eval "shuf -i 1-$NB_COMMITS -n 2")
commit1="$(echo "$randnum" | tail -1)"
commit2="$(echo "$randnum" | head -1)"
hash1=$(eval "git rev-list master -$NB_COMMITS | sed -n $commit1""p")
hash2=$(eval "git rev-list master -$NB_COMMITS | sed -n $commit2""p")

mb_num=$("$SCRIPT_DIR/merge_bases_count.sh" "$hash1" "$hash2")
if test "$mb_num" -gt 2
then
echo "$hash1 $hash2 : $mb_num" >> "$COUNT_LOG"
fi
done
26 changes: 15 additions & 11 deletions merge_bases_count.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@
#
# Count merge bases with bisect

BISECT_LOG="my_bisect_log.txt"
# export LC_ALL=C
touch $BISECT_LOG
trap "git bisect reset" INT

hash1="$1"
hash2="$2"

hash1=$1
hash2=$2
BISECT_LOG="my_bisect_log.txt"

git bisect start $hash1 $hash2 > $BISECT_LOG
git bisect start "$hash1" "$hash2" --no-checkout > "$BISECT_LOG"
count=0

while grep -q "merge base must be tested" $BISECT_LOG
if grep -q "Some good revs are not ancestors of the bad rev" "$BISECT_LOG"
then
return 0
fi

while grep -q "merge base must be tested" "$BISECT_LOG"
do
git bisect good > $BISECT_LOG
git bisect good > "$BISECT_LOG"
count=$(($count + 1))
done

echo "Merge bases: $count"
echo "$count"

git bisect reset
rm $BISECT_LOG
rm "$BISECT_LOG"
3 changes: 2 additions & 1 deletion remove_many_parents.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ while read -r commit
do
echo "Processing $commit"
GIT_EDITOR="$SCRIPT_DIR/remove_parent.sh" git replace --edit "$commit"
test $("$SCRIPT_DIR/merge_bases_count.sh" "$hash1" "$hash2") -eq "$nb_mb" ||
mb_counts=$("$SCRIPT_DIR/merge_bases_count.sh" "$hash1" "$hash2")
test "$mb_counts" = "$nb_mb" ||
git replace -d "$commit"
done <"$TMP_MERGE_COMMITS"

Expand Down