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