mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 03:47:20 +00:00
Fixed test
This commit is contained in:
parent
c09cd8795d
commit
0d9ec12402
1 changed files with 25 additions and 25 deletions
50
diff-sha.sh
50
diff-sha.sh
|
@ -215,6 +215,31 @@ else
|
|||
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
|
||||
if [[ -f .git/shallow ]]; then
|
||||
depth=$INPUT_FETCH_DEPTH
|
||||
max_depth=$INPUT_MAX_FETCH_DEPTH
|
||||
|
||||
while ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null; do
|
||||
echo "Fetching $depth commits..."
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$depth" origin +"$GITHUB_REF":refs/remotes/origin/"$CURRENT_BRANCH"
|
||||
|
||||
PREVIOUS_SHA=$(git merge-base origin/"$TARGET_BRANCH" "$CURRENT_SHA" 2>&1)
|
||||
|
||||
if [[ $depth -gt $max_depth ]]; then
|
||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
depth=$((depth + 300))
|
||||
done
|
||||
else
|
||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||
else
|
||||
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
|
||||
|
@ -223,31 +248,6 @@ else
|
|||
echo "::debug::Target branch: $TARGET_BRANCH"
|
||||
echo "::debug::Current branch: $CURRENT_BRANCH"
|
||||
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
|
||||
if [[ -f .git/shallow ]]; then
|
||||
depth=$INPUT_FETCH_DEPTH
|
||||
max_depth=$INPUT_MAX_FETCH_DEPTH
|
||||
|
||||
while ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null; do
|
||||
echo "Fetching $depth commits..."
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$depth" origin +"$GITHUB_REF":refs/remotes/origin/"$CURRENT_BRANCH"
|
||||
|
||||
PREVIOUS_SHA=$(git merge-base origin/"$TARGET_BRANCH" "$CURRENT_SHA" 2>&1)
|
||||
|
||||
if [[ $depth -gt $max_depth ]]; then
|
||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
depth=$((depth + 300))
|
||||
done
|
||||
else
|
||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Verifying the previous commit SHA: $PREVIOUS_SHA"
|
||||
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$?
|
||||
|
||||
|
|
Loading…
Reference in a new issue