Skip to content

Commit 4c5d20f

Browse files
committed
Adds storedMergeTargetBranch in merge target search util function
This uses the user defined value first and only when it's not set we fall back to other possible values. (#4443, #4522)
1 parent a6a23eb commit 4c5d20f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/git/utils/-webview/branch.utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ export async function getBranchMergeTargetName(
8888
},
8989
): Promise<MaybePausedResult<string | undefined>> {
9090
async function getMergeTargetFallback() {
91-
const [baseResult, defaultResult] = await Promise.allSettled([
91+
const [storedBase, baseResult, defaultResult] = await Promise.allSettled([
92+
container.git.getRepositoryService(branch.repoPath).branches.getStoredMergeTargetBranchName?.(branch.name),
9293
container.git
9394
.getRepositoryService(branch.repoPath)
9495
.branches.getBaseBranchName?.(branch.name, options?.cancellation),
9596
getDefaultBranchName(container, branch.repoPath, branch.getRemoteName(), {
9697
cancellation: options?.cancellation,
9798
}),
9899
]);
99-
return getSettledValue(baseResult) ?? getSettledValue(defaultResult);
100+
return getSettledValue(storedBase) ?? getSettledValue(baseResult) ?? getSettledValue(defaultResult);
100101
}
101102

102103
const result = await getBranchMergeTargetNameWithoutFallback(container, branch, options);

0 commit comments

Comments
 (0)