Updated the retrieving the merge-base
This commit is contained in:
parent
c21087a6bb
commit
2e4e636392
13
diff-sha.sh
13
diff-sha.sh
@ -185,19 +185,18 @@ else
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
|
||||
if [[ -f .git/shallow ]]; then
|
||||
depth=$INPUT_FETCH_DEPTH
|
||||
|
||||
while [ -z "$( git merge-base "$TARGET_BRANCH" HEAD )" ]; do
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD;
|
||||
depth=$((depth * 10))
|
||||
max_depth=$INPUT_MAX_FETCH_DEPTH
|
||||
|
||||
while [ -z "$( git merge-base --fork-point "$TARGET_BRANCH" HEAD )" ] || [ -z "$(git merge-base "$TARGET_BRANCH" HEAD)" ]; do
|
||||
depth=$((depth + 300))
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD;
|
||||
|
||||
if [[ $depth -gt $max_depth ]]; then
|
||||
if [ -z "$(git merge-base --fork-point "$TARGET_BRANCH" HEAD)" ]; then
|
||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and HEAD"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
||||
|
Loading…
x
Reference in New Issue
Block a user