sync_client_software: fetch depth=1 and clean untracked files on upgrade

Replace the broken `git rebase HEAD^` with a proper shallow fetch:
- `git fetch --depth=1` limits local history to one commit, regardless of server history
- `git reset --hard FETCH_HEAD` syncs the working tree to the fetched tip
- `git clean -fd` removes untracked non-ignored files left by old versions
- `git gc --prune=now` immediately purges unreachable history objects

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel unbrot Pätzold
2026-05-04 18:56:33 +02:00
parent 53b87fbe76
commit 1ac952c094
+2 -2
View File
@@ -51,8 +51,8 @@ if [[ ! -z "${REPO_URL}" ]]; then
else else
# Doing upgrade, discarding all local changes frist (is more save than forced pull) # Doing upgrade, discarding all local changes frist (is more save than forced pull)
echo "Checks have passed, we are now upgrading via git." echo "Checks have passed, we are now upgrading via git."
#Fetch latest Updates and remove all history #Fetch latest commit only (depth=1), reset working tree, purge old history and untracked files
git fetch origin && git reset --hard origin/${REPO_BRANCH} && git rebase HEAD^ git fetch --depth=1 origin ${REPO_BRANCH} && git reset --hard FETCH_HEAD && git clean -fd && git gc --prune=now --quiet
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Error: Failure while updating, will continue as is." echo "Error: Failure while updating, will continue as is."
fi fi