From a7ac787165402959e2203bb9cd4169ebbf771aed Mon Sep 17 00:00:00 2001 From: Flux Labs Date: Sat, 14 Mar 2026 09:50:22 -0500 Subject: [PATCH] fix: handle empty index after runtime file stripping in squash-merge (#364) --- src/resources/extensions/gsd/git-service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/gsd/git-service.ts b/src/resources/extensions/gsd/git-service.ts index a690e2641..95164b87c 100644 --- a/src/resources/extensions/gsd/git-service.ts +++ b/src/resources/extensions/gsd/git-service.ts @@ -839,7 +839,15 @@ export class GitServiceImpl { } if (strategy === "squash") { - this.git(["commit", "-F", "-"], { input: message }); + // After stripping runtime files, there may be nothing left to commit. + // This happens when the only changes in the slice were runtime artifacts. + const stagedDiff = this.git(["diff", "--cached", "--stat"], { allowFailure: true }); + if (stagedDiff?.trim()) { + this.git(["commit", "-F", "-"], { input: message }); + } else { + // Nothing to commit — clean up the squash-merge state + this.git(["reset", "HEAD"], { allowFailure: true }); + } } else { // --no-ff already committed; amend to include runtime file removal const runtimeDiff = this.git(["diff", "--cached", "--stat"], { allowFailure: true });