mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 13:47:20 +00:00
chore: remove extra space. (#576)
This commit is contained in:
parent
f834a938f2
commit
234423e82b
1 changed files with 15 additions and 15 deletions
30
diff-sha.sh
30
diff-sha.sh
|
@ -40,12 +40,12 @@ fi
|
||||||
echo "::debug::Getting HEAD SHA..."
|
echo "::debug::Getting HEAD SHA..."
|
||||||
|
|
||||||
if [[ -z $INPUT_SHA ]]; then
|
if [[ -z $INPUT_SHA ]]; then
|
||||||
CURRENT_SHA=$(git rev-list -n 1 "HEAD" 2>&1) ; exit_status=$?
|
CURRENT_SHA=$(git rev-list -n 1 "HEAD" 2>&1); exit_status=$?
|
||||||
else
|
else
|
||||||
CURRENT_SHA=$INPUT_SHA ; exit_status=$?
|
CURRENT_SHA=$INPUT_SHA; exit_status=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1 ; exit_status=$?
|
git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::error::Unable to locate the current sha: $CURRENT_SHA"
|
echo "::error::Unable to locate the current sha: $CURRENT_SHA"
|
||||||
|
@ -63,22 +63,22 @@ if [[ -z $GITHUB_BASE_REF ]]; then
|
||||||
|
|
||||||
if [[ -z $INPUT_BASE_SHA ]]; then
|
if [[ -z $INPUT_BASE_SHA ]]; then
|
||||||
if [[ $(git rev-list --count "HEAD") -gt 1 ]]; then
|
if [[ $(git rev-list --count "HEAD") -gt 1 ]]; then
|
||||||
PREVIOUS_SHA=$(git rev-parse "@~" 2>&1) ; exit_status=$?
|
PREVIOUS_SHA=$(git rev-parse "@~" 2>&1); exit_status=$?
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$CURRENT_SHA ; exit_status=$?
|
PREVIOUS_SHA=$CURRENT_SHA; exit_status=$?
|
||||||
INITIAL_COMMIT="true"
|
INITIAL_COMMIT="true"
|
||||||
echo "::debug::Initial commit detected"
|
echo "::debug::Initial commit detected"
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$INPUT_BASE_SHA ; exit_status=$?
|
PREVIOUS_SHA=$INPUT_BASE_SHA; exit_status=$?
|
||||||
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) ; exit_status=$?
|
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1); exit_status=$?
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
echo "::debug::Target branch: $TARGET_BRANCH"
|
echo "::debug::Target branch: $TARGET_BRANCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 ; exit_status=$?
|
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"
|
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"
|
||||||
|
@ -94,24 +94,24 @@ else
|
||||||
if [[ -z $INPUT_BASE_SHA ]]; then
|
if [[ -z $INPUT_BASE_SHA ]]; then
|
||||||
if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then
|
if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then
|
||||||
echo "::debug::Getting fork point..."
|
echo "::debug::Getting fork point..."
|
||||||
git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" ; exit_status=$?
|
git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}"; exit_status=$?
|
||||||
PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")") ; exit_status=$?
|
PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")"); exit_status=$?
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
else
|
else
|
||||||
git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}" ; exit_status=$?
|
git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}"; exit_status=$?
|
||||||
PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1) ; exit_status=$?
|
PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1); exit_status=$?
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
git fetch --no-tags -u --progress origin --depth=1 "$INPUT_BASE_SHA" ; exit_status=$?
|
git fetch --no-tags -u --progress origin --depth=1 "$INPUT_BASE_SHA"; exit_status=$?
|
||||||
PREVIOUS_SHA=$INPUT_BASE_SHA
|
PREVIOUS_SHA=$INPUT_BASE_SHA
|
||||||
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) ; exit_status=$?
|
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1); exit_status=$?
|
||||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||||
echo "::debug::Target branch: $TARGET_BRANCH"
|
echo "::debug::Target branch: $TARGET_BRANCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::debug::Verifying commit SHA..."
|
echo "::debug::Verifying commit SHA..."
|
||||||
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 ; exit_status=$?
|
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"
|
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"
|
||||||
|
|
Loading…
Reference in a new issue