Skip to content

Commit 20724f7

Browse files
fix default path bug related to branch prefix (microsoft#258709)
* fix default path bug related to branch prefix * remove branch prefix first, then get last component * replace / with - * clean up
1 parent 2181108 commit 20724f7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

extensions/git/src/commands.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,10 +3455,9 @@ export class CommandCenter {
34553455
commitish = choice.refName;
34563456
}
34573457

3458-
3459-
const worktreeName = (branch ?? commitish).startsWith(branchPrefix)
3460-
? (branch ?? commitish).substring(branchPrefix.length)
3461-
: (branch ?? commitish);
3458+
const worktreeName = ((branch ?? commitish).startsWith(branchPrefix)
3459+
? (branch ?? commitish).substring(branchPrefix.length).replace(/\//g, '-')
3460+
: (branch ?? commitish).replace(/\//g, '-'));
34623461

34633462
// If user selects folder button, they manually select the worktree path through folder picker
34643463
const getWorktreePath = async (): Promise<string | undefined> => {

0 commit comments

Comments
 (0)