From bcbc2a45bcaf2284111ce1026499ac1459a9dd03 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Thu, 1 Oct 2026 16:07:10 -0700 Subject: [PATCH] Allow behind checkouts to deploy pushed main without permitting unpublished commits --- lith/deploy.fish | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lith/deploy.fish b/lith/deploy.fish index c7d0d26f42..66daaa2be5 100644 --- a/lith/deploy.fish +++ b/lith/deploy.fish @@ -193,8 +193,10 @@ end if test "$LOCAL_BRANCH" = "$TARGET_BRANCH" set LOCAL_HEAD (git -C $REPO_ROOT rev-parse HEAD) - if test "$LOCAL_HEAD" != "$ORIGIN_HEAD" - echo -e "$RED x Local $TARGET_BRANCH is ahead of origin/$TARGET_BRANCH.$NC" + # A behind checkout is safe: production uses origin's pushed commit below. + # Refuse only local commits not preserved on the deployment branch. + if not git -C $REPO_ROOT merge-base --is-ancestor $LOCAL_HEAD $ORIGIN_HEAD + echo -e "$RED x Local $TARGET_BRANCH is ahead of or diverged from origin/$TARGET_BRANCH.$NC" echo -e "$YELLOW Push first. This deploy script no longer rsyncs uncommitted or unpushed code into production.$NC" exit 1 end -- 2.51.2