浏览代码

Creates local branch for remote branch worktrees

Removes remote name from remote branch worktrees path
main
Eric Amodio 1年前
父节点
当前提交
bdd847ecb4
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. +10
    -1
      src/commands/git/worktree.ts

+ 10
- 1
src/commands/git/worktree.ts 查看文件

@ -343,6 +343,12 @@ export class WorktreeGitCommand extends QuickCommand {
state.confirm = true;
this.canSkipConfirmOverride = undefined;
const isRemoteBranch = state.reference?.refType === 'branch' && state.reference?.remote;
if (isRemoteBranch && !state.flags.includes('-b')) {
state.flags.push('-b');
state.createBranch = GitReference.getNameWithoutRemote(state.reference);
}
if (state.flags.includes('-b') && state.createBranch == null) {
const result = yield* inputBranchNameStep(state, context, {
placeholder: 'Please provide a name for the new branch',
@ -558,7 +564,10 @@ export class WorktreeGitCommand extends QuickCommand {
const recommendedUri =
state.reference != null
? Uri.joinPath(recommendedRootUri, ...state.reference.name.replace(/\\/g, '/').split('/'))
? Uri.joinPath(
recommendedRootUri,
...GitReference.getNameWithoutRemote(state.reference).replace(/\\/g, '/').split('/'),
)
: recommendedRootUri;
const recommendedFriendlyPath = truncateLeft(GitWorktree.getFriendlyPath(recommendedUri), 65);

正在加载...
取消
保存