Skip to content

Commit

Permalink
feat: fallback to fork-point
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Dec 16, 2022
1 parent 3472a62 commit 427b9f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions diff-sha.sh
Expand Up @@ -248,15 +248,17 @@ else
for ((i=0; i<max_depth; i+=depth)); do
if git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/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
Expand Down

0 comments on commit 427b9f9

Please sign in to comment.