From b109d83a62e94cf7c522bf6c15cb25c175850b16 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 6 Apr 2023 20:56:59 -0600 Subject: [PATCH] fix: error finding merge base (#1077) --- diff-sha.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index c3651fa1..cd707b6b 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -251,13 +251,13 @@ else if [[ "$IS_SHALLOW" == "true" ]]; then # check if the merge base is in the local history - if ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then + if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then echo "::debug::Merge base is not in the local history, fetching remote target branch..." # Fetch more of the target branch history until the merge base is found for i in {1..10}; do # shellcheck disable=SC2086 git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null - if git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then + if git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then break fi echo "::debug::Merge base is not in the local history, fetching remote target branch again..."