diff --git a/deploy/sync-vps-repos.sh b/deploy/sync-vps-repos.sh index 6757279..043f715 100755 --- a/deploy/sync-vps-repos.sh +++ b/deploy/sync-vps-repos.sh @@ -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