From 427b9f931d9ecaa450594be881e9753fa9bbad8f Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 15 Dec 2022 12:20:18 -0700 Subject: [PATCH] feat: fallback to fork-point --- diff-sha.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 752705a2..8d9ac33d 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -248,15 +248,17 @@ else for ((i=0; i/dev/null 2>&1; then break + else + PREVIOUS_SHA=$(git merge-base --fork-point "$PREVIOUS_SHA" "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$? fi - + echo "Fetching $i commits..." # shellcheck disable=SC2086 git fetch $EXTRA_ARGS -u --progress --deepen="$i" origin $TARGET_BRANCH $CURRENT_SHA 1>/dev/null 2>&1 done - if ((i > max_depth)); then + if ((i >= max_depth)); then echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_BRANCH with: $PREVIOUS_SHA$DIFF$CURRENT_SHA" exit 1 fi