3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-17 19:17:45 +00:00

Update diff-sha.sh

This commit is contained in:
Tonye Jack 2022-11-15 11:08:51 -07:00 committed by GitHub
parent e7e332ee69
commit 4203489288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,16 +211,18 @@ else
depth=$INPUT_FETCH_DEPTH depth=$INPUT_FETCH_DEPTH
max_depth=$INPUT_MAX_FETCH_DEPTH max_depth=$INPUT_MAX_FETCH_DEPTH
while [ -z "$( git merge-base --fork-point "$TARGET_BRANCH" "$CURRENT_SHA" )" ] || [ -z "$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA")" ] || [ -z "$(git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" | head -1)" ]; do while ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" 1>/dev/null; do
depth=$((depth + 300)) echo "Fetching $depth commits..."
# shellcheck disable=SC2086 # shellcheck disable=SC2086
git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD; git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" "$CURRENT_SHA";
if [[ $depth -gt $max_depth ]]; then if [[ $depth -gt $max_depth ]]; then
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and HEAD" echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and "$CURRENT_SHA""
exit 1 exit 1
fi fi
depth=$((depth + 300))
done done
else else
echo "::debug::Not a shallow clone, skipping merge-base check." echo "::debug::Not a shallow clone, skipping merge-base check."