Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve ref in desktop remote -> local clone #189852

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 15 additions & 9 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,20 +749,26 @@ export class CommandCenter {
const ref = selection.repository.HEAD?.upstream?.name;

if (uri !== undefined) {
// Launch desktop client if currently in web
let target = `${env.uriScheme}://vscode.git/clone?url=${encodeURIComponent(uri)}`;
if (env.uiKind === UIKind.Web) {
const isWeb = env.uiKind === UIKind.Web;
const isRemote = env.remoteName !== undefined;

if (isWeb || isRemote) {
if (ref !== undefined) {
target += `&ref=${encodeURIComponent(ref)}`;
}
return Uri.parse(target);
}

// If already in desktop client but in a remote window, we need to force a new window
// so that the git extension can access the local filesystem for cloning
if (env.remoteName !== undefined) {
target += `&windowId=_blank`;
return Uri.parse(target);
if (isWeb) {
// Launch desktop client if currently in web
return Uri.parse(target);
}

if (isRemote) {
// If already in desktop client but in a remote window, we need to force a new window
// so that the git extension can access the local filesystem for cloning
target += `&windowId=_blank`;
return Uri.parse(target);
}
}

// Otherwise, directly clone
Expand Down