mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 13:47:20 +00:00
Update diff-sha.sh
This commit is contained in:
parent
a4f296d02e
commit
a84c8f54f9
1 changed files with 8 additions and 6 deletions
14
diff-sha.sh
14
diff-sha.sh
|
@ -220,7 +220,7 @@ else
|
|||
depth=$INPUT_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..."
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
|
@ -228,13 +228,15 @@ else
|
|||
|
||||
PREVIOUS_SHA=$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
||||
|
||||
if [[ $depth -gt $max_depth ]]; then
|
||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
||||
exit 1
|
||||
if git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
|
||||
depth=$((depth + 300))
|
||||
done
|
||||
|
||||
if ((i >= max_depth)); then
|
||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue