From 641e287bf6a8e6b023ba9449d76853a633e03628 Mon Sep 17 00:00:00 2001
From: Fong Kye Pascal
Date: Fri, 8 Dec 2017 21:05:43 +0100
Subject: [PATCH] fix: #39738 Replaces starting tilde with home directory when
entered in git clone prompt
---
extensions/git/src/commands.ts | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts
index 07e7594aa6b96..b6c1c8bd33df3 100644
--- a/extensions/git/src/commands.ts
+++ b/extensions/git/src/commands.ts
@@ -307,6 +307,10 @@ export class CommandCenter {
return '';
}
+ private handlePathTilde(path: string): string {
+ return path.replace(/^~/, os.homedir());
+ }
+
private static cloneId = 0;
@command('git.clone')
@@ -330,11 +334,10 @@ export class CommandCenter {
const config = workspace.getConfiguration('git');
let value = config.get('defaultCloneDirectory') || os.homedir();
- value = value.replace(/^~/, os.homedir());
const parentPath = await window.showInputBox({
prompt: localize('parent', "Parent Directory"),
- value,
+ value: this.handlePathTilde(value),
ignoreFocusOut: true
});
@@ -358,7 +361,7 @@ export class CommandCenter {
statusBarItem.command = cancelCommandId;
statusBarItem.show();
- const clonePromise = this.git.clone(url, parentPath, tokenSource.token);
+ const clonePromise = this.git.clone(url, this.handlePathTilde(parentPath), tokenSource.token);
try {
window.withProgress({ location: ProgressLocation.SourceControl, title: localize('cloning', "Cloning git repository...") }, () => clonePromise);