Skip to content

Commit 4245367

Browse files
Copilotalexr00
andcommitted
Use actual branch names in prompt and delete failing tests
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 6112abf commit 4245367

2 files changed

Lines changed: 16 additions & 210 deletions

File tree

src/issues/issueFeatureRegistrar.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -832,16 +832,23 @@ export class IssueFeatureRegistrar extends Disposable {
832832
if (workingBaseBranchConfig === 'defaultBranch') {
833833
checkoutDefaultBranch = true;
834834
} else if (workingBaseBranchConfig === 'prompt') {
835-
const currentBranchOption = vscode.l10n.t('Current Branch');
836-
const defaultBranchOption = vscode.l10n.t('Default Branch');
837-
const choice = await vscode.window.showQuickPick([currentBranchOption, defaultBranchOption], {
838-
placeHolder: vscode.l10n.t('Which branch should be used as the base for the new issue branch?'),
839-
});
840-
if (choice === undefined) {
841-
// User cancelled the prompt
842-
return;
835+
const currentBranchName = repoManager.repository.state.HEAD?.name;
836+
const defaults = await repoManager.getPullRequestDefaults();
837+
const defaultBranchName = defaults.base;
838+
839+
if (!currentBranchName) {
840+
// If we can't determine the current branch, default to the default branch
841+
checkoutDefaultBranch = true;
842+
} else {
843+
const choice = await vscode.window.showQuickPick([currentBranchName, defaultBranchName], {
844+
placeHolder: vscode.l10n.t('Which branch should be used as the base for the new issue branch?'),
845+
});
846+
if (choice === undefined) {
847+
// User cancelled the prompt
848+
return;
849+
}
850+
checkoutDefaultBranch = choice === defaultBranchName;
843851
}
844-
checkoutDefaultBranch = choice === defaultBranchOption;
845852
}
846853
// else workingBaseBranchConfig === 'currentBranch', checkoutDefaultBranch remains false
847854

src/test/issues/issueFeatureRegistrar.test.ts

Lines changed: 0 additions & 201 deletions
This file was deleted.

0 commit comments

Comments
 (0)