Skip to content

Commit 18f93f1

Browse files
committed
Fixes #4049 corrects worktree uri
1 parent 8ed5684 commit 18f93f1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/commands/git/worktree.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const subcommandToTitleMap = new Map<State['subcommand'] | undefined, string>([
180180
['create', `Create Worktree`],
181181
['delete', `Delete Worktrees`],
182182
['open', `Open Worktree`],
183-
['copy-changes', 'Copy Changes to'],
183+
['copy-changes', 'Copy Changes to Worktree'],
184184
]);
185185
function getTitle(subcommand: State['subcommand'] | undefined, suffix?: string) {
186186
return `${subcommandToTitleMap.get(subcommand)}${suffix ?? ''}`;
@@ -1153,12 +1153,15 @@ export class WorktreeGitCommand extends QuickCommand<State> {
11531153
let placeholder;
11541154
switch (state.changes.type) {
11551155
case 'index':
1156+
context.title = state?.overrides?.title ?? 'Copy Staged Changes to Worktree';
11561157
placeholder = 'Choose a worktree to copy your staged changes to';
11571158
break;
11581159
case 'working-tree':
1160+
context.title = state?.overrides?.title ?? 'Copy Working Changes to Worktree';
11591161
placeholder = 'Choose a worktree to copy your working changes to';
11601162
break;
11611163
default:
1164+
context.title = state?.overrides?.title ?? 'Copy Changes to Worktree';
11621165
placeholder = 'Choose a worktree to copy changes to';
11631166
break;
11641167
}
@@ -1193,9 +1196,9 @@ export class WorktreeGitCommand extends QuickCommand<State> {
11931196
}
11941197

11951198
if (!isSha(state.changes.baseSha)) {
1196-
const commit = await state.repo.git.commits().getCommit(state.changes.baseSha);
1197-
if (commit != null) {
1198-
state.changes.baseSha = commit.sha;
1199+
const sha = await state.repo.git.resolveReference(state.changes.baseSha, undefined, { force: true });
1200+
if (sha != null) {
1201+
state.changes.baseSha = sha;
11991202
}
12001203
}
12011204

@@ -1207,7 +1210,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
12071210
endSteps(state);
12081211

12091212
try {
1210-
const patchProvider = this.container.git.patch(state.worktree.repoPath);
1213+
const patchProvider = this.container.git.patch(state.worktree.uri);
12111214
const commit = await patchProvider?.createUnreachableCommitForPatch(
12121215
state.changes.contents,
12131216
state.changes.baseSha,

0 commit comments

Comments
 (0)