Skip to content

Commit

Permalink
use native dialog for git clone
Browse files Browse the repository at this point in the history
fixes #48492
  • Loading branch information
joaomoreno committed Apr 26, 2018
1 parent f765117 commit d138091
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,18 @@ export class CommandCenter {
}

const config = workspace.getConfiguration('git');
let value = config.get<string>('defaultCloneDirectory') || os.homedir();

const parentPath = await window.showInputBox({
prompt: localize('parent', "Parent Directory"),
value,
ignoreFocusOut: true
let defaultCloneDirectory = config.get<string>('defaultCloneDirectory') || os.homedir();
defaultCloneDirectory = defaultCloneDirectory.replace(/^~/, os.homedir());

const uris = await window.showOpenDialog({
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: Uri.file(defaultCloneDirectory),
openLabel: localize('selectFolder', "Select Repository Location")
});

if (!parentPath) {
if (!uris || uris.length === 0) {
/* __GDPR__
"clone" : {
"outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
Expand All @@ -366,6 +369,9 @@ export class CommandCenter {
return;
}

const uri = uris[0];
const parentPath = uri.fsPath;

try {
const opts = {
location: ProgressLocation.Notification,
Expand All @@ -375,7 +381,7 @@ export class CommandCenter {

const repositoryPath = await window.withProgress(
opts,
(_, token) => this.git.clone(url!, parentPath.replace(/^~/, os.homedir()), token)
(_, token) => this.git.clone(url!, parentPath, token)
);

const choices = [];
Expand Down

0 comments on commit d138091

Please sign in to comment.