Skip to content

Commit 5028125

Browse files
committed
git: Refactor SHA reset logic in entrypoint.sh
Replace git checkout with git reset for better handling of SHA resets. Signed-off-by: Chiho Sin <[email protected]>
1 parent 4b113b6 commit 5028125

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,18 @@ if ! git rev-parse "${GITHUB_SHA}" >/dev/null 2>&1; then
1919
echo "SHA ${GITHUB_SHA} not found locally. Fetching from origin..."
2020
git fetch origin "${GITHUB_SHA}" --tags --prune || echo "SHA not found in origin."
2121
fi
22-
2322
if ! git rev-parse "${GITHUB_SHA}" >/dev/null 2>&1; then
2423
echo "SHA ${GITHUB_SHA} not found in origin. Fetching from fork..."
2524
git fetch fork "${GITHUB_SHA}" --tags --prune || echo "SHA not found in fork."
2625
fi
27-
2826
# Final check: If SHA still doesn't exist, fail
2927
if ! git rev-parse "${GITHUB_SHA}" >/dev/null 2>&1; then
3028
echo "Error: SHA ${GITHUB_SHA} not found in either remote."
3129
exit 1
3230
fi
31+
# Reset to the target SHA
32+
git reset --hard "${GITHUB_SHA}"
3333

34-
git checkout "${GITHUB_SHA}"
3534
make -C ports/"${CPY_PLATFORM}" fetch-port-submodules
3635
pip3 install --upgrade -r requirements-dev.txt
3736
pip3 install --upgrade -r requirements-doc.txt

0 commit comments

Comments
 (0)