From 63466fb75baefe3e806a4f9655fd7a0b55778db9 Mon Sep 17 00:00:00 2001 From: grendervill Date: Tue, 22 Sep 2026 20:49:29 +0300 Subject: [PATCH] =?UTF-8?q?fix(ops):=20update=20=D0=BD=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=D0=B5=D1=82=20shallow-fetch=20=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=8A=D1=8F=D1=81=D0=BD=D1=8F=D0=B5=D1=82=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=84=D0=BB=D0=B8=D0=BA=D1=82=20=D0=B2=D0=B5=D1=82?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Частичный fetch переводил обычный клон в shallow, после чего pull --ff-only падал с «Not possible to fast-forward» без подсказки, что делать. --- deploy/update.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy/update.sh b/deploy/update.sh index 12e4382..944b84b 100755 --- a/deploy/update.sh +++ b/deploy/update.sh @@ -59,11 +59,16 @@ if [ "$APP_IMAGE" = "glchat:local" ] || [ -z "${APP_IMAGE:-}" ]; then REPO_DIR="${GLCHAT_REPO_DIR:-$REPO_DIR_DEFAULT}" if [ -d "${REPO_DIR}/.git" ]; then log "обновляем исходники в ${REPO_DIR}" - git -C "$REPO_DIR" fetch --tags --depth 1 origin + # Без --depth: частичный fetch переводит обычный клон в shallow, и + # следующий `pull --ff-only` падает с «Not possible to fast-forward». + git -C "$REPO_DIR" fetch --tags origin || + die "не удалось получить обновления; проверьте доступ к ${REPO_DIR}" if [ -n "$TARGET_VERSION" ]; then - git -C "$REPO_DIR" checkout "$TARGET_VERSION" + git -C "$REPO_DIR" checkout "$TARGET_VERSION" || + die "не удалось переключиться на ${TARGET_VERSION}" else - git -C "$REPO_DIR" pull --ff-only + git -C "$REPO_DIR" pull --ff-only || + die "локальные изменения мешают обновлению: git -C ${REPO_DIR} reset --hard origin/main" fi log "пересобираем образ" docker build -t "${APP_IMAGE:-glchat:local}" \