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:
1 parent
fe4cb38f0b
commit
5eca430cce
1 file changed
+4
-11
@@ -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
|
||||
fi
|
||||
fi
|
||||
echo "[1/5] Updating ${REPOS_ROOT}/${repo} (${remote_name}/${branch}) with autostash rebase..."
|
||||
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 pull --rebase --autostash ${repo}" git ${GIT_SSH_FLAGS[@]+"${GIT_SSH_FLAGS[@]}"} -C "${REPOS_ROOT}/${repo}" pull --rebase -X theirs --autostash "${remote_name}" "${branch}"
|
||||
fi
|
||||
git -C "${REPOS_ROOT}/${repo}" stash pop -q || true
|
||||
echo "[1/5] Updating ${REPOS_ROOT}/${repo} (${remote_name}/${branch}) with clean remote reset..."
|
||||
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 reset --hard ${remote_name}/${branch}" git -C "${REPOS_ROOT}/${repo}" reset --hard "${remote_name}/${branch}"
|
||||
run_checked "git clean -fd" git -C "${REPOS_ROOT}/${repo}" clean -fd
|
||||
unmerged_paths="$(git -C "${REPOS_ROOT}/${repo}" diff --name-only --diff-filter=U || true)"
|
||||
if [[ -n "${unmerged_paths}" ]]; then
|
||||
while IFS= read -r uf; do
|
||||
|
||||
Reference in new issue
Block a user