fix: eliminate branch checkout during slice merge that caused STATE.md conflicts (#302)
The merge flow checked out the slice branch mid-merge to untrack runtime files, which failed when .gsd/STATE.md had uncommitted working tree changes. Instead, strip runtime files from the staged merge result post-merge — no branch switching needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3cf7b7435e
commit
9feca64496
1 changed files with 14 additions and 13 deletions
|
|
@ -657,18 +657,6 @@ export class GitServiceImpl {
|
|||
this.git(["commit", "-m", "chore: untrack .gsd/ runtime files before merge"], { allowFailure: true });
|
||||
}
|
||||
|
||||
// Also untrack runtime files from the slice branch to prevent
|
||||
// modify/delete conflicts during squash-merge (#218)
|
||||
this.git(["checkout", branch]);
|
||||
for (const exclusion of RUNTIME_EXCLUSION_PATHS) {
|
||||
this.git(["rm", "--cached", "-r", "--ignore-unmatch", exclusion], { allowFailure: true });
|
||||
}
|
||||
const branchUntrackDiff = this.git(["diff", "--cached", "--stat"], { allowFailure: true });
|
||||
if (branchUntrackDiff?.trim()) {
|
||||
this.git(["commit", "-m", "chore: untrack .gsd/ runtime files before merge"], { allowFailure: true });
|
||||
}
|
||||
this.git(["checkout", mainBranch]);
|
||||
|
||||
// Merge slice branch — strategy is configurable via git.merge_strategy
|
||||
// preference. Default: "squash" (preserves existing behavior).
|
||||
// "merge" uses --no-ff which is more resilient to conflicts from
|
||||
|
|
@ -730,9 +718,22 @@ export class GitServiceImpl {
|
|||
}
|
||||
}
|
||||
|
||||
// Squash merge needs a separate commit; --no-ff merge already committed
|
||||
// Strip runtime files from the merge result before committing (#302).
|
||||
// This replaces the old approach of checking out the slice branch to
|
||||
// untrack runtime files pre-merge, which failed when the working tree
|
||||
// had uncommitted .gsd/ changes that blocked the checkout.
|
||||
for (const exclusion of RUNTIME_EXCLUSION_PATHS) {
|
||||
this.git(["rm", "--cached", "-r", "--ignore-unmatch", exclusion], { allowFailure: true });
|
||||
}
|
||||
|
||||
if (strategy === "squash") {
|
||||
this.git(["commit", "-F", "-"], { input: message });
|
||||
} else {
|
||||
// --no-ff already committed; amend to include runtime file removal
|
||||
const runtimeDiff = this.git(["diff", "--cached", "--stat"], { allowFailure: true });
|
||||
if (runtimeDiff?.trim()) {
|
||||
this.git(["commit", "--amend", "--no-edit"]);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the merged branch
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue