fix(deploy): replace fragile stash/rebase pull with deterministic git reset --hard and git clean -fd in sync-vps-repos.sh

This commit is contained in:
Hermes Agent committed 2026-12-02 13:49:33 +00:00
1 parent fe4cb38f0b
commit 5eca430cce
1 file changed
+3 -10
+3 -10
View File
@@ -144,17 +144,10 @@ if [[ "${DO_PULL}" -eq 1 ]]; then
git -C "${REPOS_ROOT}/${repo}" remote set-url "${remote_name}" "https://git.libre.audio/seasharp/${slug}.git" || true git -C "${REPOS_ROOT}/${repo}" remote set-url "${remote_name}" "https://git.libre.audio/seasharp/${slug}.git" || true
fi fi
fi fi
echo "[1/5] Updating ${REPOS_ROOT}/${repo} (${remote_name}/${branch}) with autostash rebase..." echo "[1/5] Updating ${REPOS_ROOT}/${repo} (${remote_name}/${branch}) with clean remote reset..."
git -C "${REPOS_ROOT}/${repo}" stash -u || true
prev_head="$(git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -C "${REPOS_ROOT}/${repo}" rev-parse HEAD)"
if [[ "${#GIT_PULL_PREFIX[@]}" -gt 0 ]]; then
run_checked "git fetch ${repo}" "${GIT_PULL_PREFIX[@]}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -c "safe.directory=${REPOS_ROOT}/${repo}" -C "${REPOS_ROOT}/${repo}" fetch --force "${remote_name}" "${branch}" --tags
run_checked "git pull --rebase --autostash ${repo}" "${GIT_PULL_PREFIX[@]}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -c "safe.directory=${REPOS_ROOT}/${repo}" -C "${REPOS_ROOT}/${repo}" pull --rebase -X theirs --autostash "${remote_name}" "${branch}"
else
run_checked "git fetch ${repo}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -C "${REPOS_ROOT}/${repo}" fetch --force "${remote_name}" "${branch}" --tags run_checked "git fetch ${repo}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -C "${REPOS_ROOT}/${repo}" fetch --force "${remote_name}" "${branch}" --tags
run_checked "git pull --rebase --autostash ${repo}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -C "${REPOS_ROOT}/${repo}" pull --rebase -X theirs --autostash "${remote_name}" "${branch}" run_checked "git reset --hard ${remote_name}/${branch}" git -C "${REPOS_ROOT}/${repo}" reset --hard "${remote_name}/${branch}"
fi run_checked "git clean -fd" git -C "${REPOS_ROOT}/${repo}" clean -fd
git -C "${REPOS_ROOT}/${repo}" stash pop -q || true
unmerged_paths="$(git -C "${REPOS_ROOT}/${repo}" diff --name-only --diff-filter=U || true)" unmerged_paths="$(git -C "${REPOS_ROOT}/${repo}" diff --name-only --diff-filter=U || true)"
if [[ -n "${unmerged_paths}" ]]; then if [[ -n "${unmerged_paths}" ]]; then
while IFS= read -r uf; do while IFS= read -r uf; do