mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 09:26:17 -05:00
Force checkout in upgrade.sh so a dirty working tree can't abort the upgrade
scripts/upgrade.sh runs `npm install`, which rewrites app/package-lock.json
and leaves the working tree dirty. The next upgrade's `git checkout ${BRANCH}`
then aborts with "Your local changes would be overwritten by checkout" before
the following `git reset --hard` can discard them, failing the upgrade with
exit 4.
Use `git checkout -f` so the branch switch discards local modifications; the
reset --hard immediately after already forces the tree to match origin, so the
intent (blow away local changes) is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e7591b16ad
commit
f4d0468300
1 changed files with 4 additions and 1 deletions
|
|
@ -117,7 +117,10 @@ if ! git -C /opt/wrolpi verify-commit origin/"${BRANCH}" 2>&1; then
|
|||
fi
|
||||
|
||||
# Signature verified, safe to apply.
|
||||
(cd /opt/wrolpi && git checkout "${BRANCH}" && git reset --hard origin/"${BRANCH}") || exit 4
|
||||
# Force the checkout so local working-tree changes (e.g. app/package-lock.json
|
||||
# rewritten by npm install during a prior upgrade) cannot abort the switch; the
|
||||
# following reset --hard discards them anyway.
|
||||
(cd /opt/wrolpi && git checkout -f "${BRANCH}" && git reset --hard origin/"${BRANCH}") || exit 4
|
||||
|
||||
# Verify HEAD again after checkout in case the branch was swapped between fetch and checkout.
|
||||
if ! git -C /opt/wrolpi verify-commit HEAD 2>&1; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue