From cbfb7d58b63a00c82d21ae16f780ec42aa4e0b4d Mon Sep 17 00:00:00 2001 From: Jiayuan Date: Sat, 4 Apr 2026 13:23:14 +0800 Subject: [PATCH] fix: make setup-worktree preserve existing .env.worktree setup-worktree was using FORCE=1 to unconditionally regenerate .env.worktree, which overwrites any manual edits (e.g. switching to the main DB). Now it only generates the file if it doesn't exist. --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 95da2315..35431163 100644 --- a/Makefile +++ b/Makefile @@ -98,8 +98,12 @@ check-main: @ENV_FILE=$(MAIN_ENV_FILE) bash scripts/check.sh setup-worktree: - @echo "==> Generating $(WORKTREE_ENV_FILE) with unique ports..." - @FORCE=1 bash scripts/init-worktree-env.sh $(WORKTREE_ENV_FILE) + @if [ ! -f "$(WORKTREE_ENV_FILE)" ]; then \ + echo "==> Generating $(WORKTREE_ENV_FILE) with unique ports..."; \ + bash scripts/init-worktree-env.sh $(WORKTREE_ENV_FILE); \ + else \ + echo "==> Using existing $(WORKTREE_ENV_FILE)"; \ + fi @$(MAKE) setup ENV_FILE=$(WORKTREE_ENV_FILE) start-worktree: