fix(gsd): validate main_branch preference exists before using in merge
mergeMilestoneToMain used prefs.main_branch without checking if the branch exists in the repo. A stale preference (e.g. "master" when repo uses "main") caused merge failure. Now validates with nativeBranchExists before using the preference, falling through to nativeDetectMainBranch if invalid. Closes #3589 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5cc2e24800
commit
902e3be6d8
1 changed files with 6 additions and 1 deletions
|
|
@ -1453,8 +1453,13 @@ export function mergeMilestoneToMain(
|
|||
originalBasePath_,
|
||||
milestoneId,
|
||||
);
|
||||
// Validate prefs.main_branch exists before using it — a stale preference
|
||||
// (e.g. "master" when repo uses "main") causes merge failure (#3589).
|
||||
const validatedPrefBranch = prefs.main_branch && nativeBranchExists(originalBasePath_, prefs.main_branch)
|
||||
? prefs.main_branch
|
||||
: undefined;
|
||||
const mainBranch =
|
||||
integrationBranch ?? prefs.main_branch ?? nativeDetectMainBranch(originalBasePath_);
|
||||
integrationBranch ?? validatedPrefBranch ?? nativeDetectMainBranch(originalBasePath_);
|
||||
|
||||
// Remove transient project-root state files before any branch or merge
|
||||
// operation. Untracked milestone metadata can otherwise block squash merges.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue