Update diff-sha.sh
This commit is contained in:
parent
a4f296d02e
commit
a84c8f54f9
14
diff-sha.sh
14
diff-sha.sh
@ -220,7 +220,7 @@ else
|
|||||||
depth=$INPUT_FETCH_DEPTH
|
depth=$INPUT_FETCH_DEPTH
|
||||||
max_depth=$INPUT_MAX_FETCH_DEPTH
|
max_depth=$INPUT_MAX_FETCH_DEPTH
|
||||||
|
|
||||||
while ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; do
|
for ((i=0; i<max_depth; i+=depth)); do
|
||||||
echo "Fetching $depth commits..."
|
echo "Fetching $depth commits..."
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
@ -228,13 +228,15 @@ else
|
|||||||
|
|
||||||
PREVIOUS_SHA=$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
||||||
|
|
||||||
if [[ $depth -gt $max_depth ]]; then
|
if git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
break
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
depth=$((depth + 300))
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ((i >= max_depth)); then
|
||||||
|
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
echo "::debug::Not a shallow clone, skipping merge-base check."
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user