fix: handle empty index after runtime file stripping in squash-merge (#364)

This commit is contained in:
Flux Labs 2026-03-14 09:50:22 -05:00 committed by GitHub
parent 3a1b8f457d
commit a7ac787165

View file

@ -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 });