From f19aa21df8833fafbe4bdd2c72db88f4b66cf687 Mon Sep 17 00:00:00 2001 From: Ilie Halip Date: Tue, 18 Apr 2017 15:26:28 +0300 Subject: [PATCH 1/2] added config option git.cloneDirectory, defaulting to os.homedir() --- extensions/git/package.json | 5 +++++ extensions/git/package.nls.json | 3 ++- extensions/git/src/commands.ts | 5 ++++- .../workbench/parts/git/browser/gitWorkbenchContributions.ts | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index b06bb33a1db..749b3a65c09 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -618,6 +618,11 @@ "type": "boolean", "description": "%config.ignoreLegacyWarning%", "default": false + }, + "git.cloneDirectory": { + "type": "string", + "default": null, + "description": "%config.cloneDirectory%" } } } diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 1db12e4a6b0..44eb8b422c3 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -36,5 +36,6 @@ "config.confirmSync": "Confirm before synchronizing git repositories", "config.countBadge": "Controls the git badge counter", "config.checkoutType": "Controls what type of branches are listed", - "config.ignoreLegacyWarning": "Ignores the legacy Git warning" + "config.ignoreLegacyWarning": "Ignores the legacy Git warning", + "config.cloneDirectory": "When cloning a new repository, the default location will be set to this directory" } \ No newline at end of file diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index eeccf86f2dc..61a519a66b8 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -202,9 +202,12 @@ export class CommandCenter { return; } + const config = workspace.getConfiguration('git'); + const cloneDirectory = config.get('cloneDirectory') || os.homedir(); + const parentPath = await window.showInputBox({ prompt: localize('parent', "Parent Directory"), - value: os.homedir(), + value: cloneDirectory, ignoreFocusOut: true }); diff --git a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts index e35495db433..0bdf195f96c 100644 --- a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts +++ b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts @@ -235,6 +235,11 @@ export function registerContributions(): void { enum: ['all', 'local', 'tags', 'remote'], default: 'all', description: nls.localize('checkoutType', "Controls what type of branches are listed."), + }, + 'git.cloneDirectory': { + type: 'string', + default: null, + description: nls.localize('cloneDirectory', "When cloning a new repository, the default location will be set to this directory."), } } }); From af6f8aa748e7cc5b53a2953df2f43c38db215e45 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Thu, 4 May 2017 16:04:30 +0200 Subject: [PATCH 2/2] clean up #24950 --- extensions/git/package.json | 4 ++-- extensions/git/package.nls.json | 2 +- extensions/git/src/commands.ts | 4 ++-- .../workbench/parts/git/browser/gitWorkbenchContributions.ts | 5 ----- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index e6e7d350c45..9bbce1ea371 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -609,10 +609,10 @@ "description": "%config.ignoreLimitWarning%", "default": false }, - "git.cloneDirectory": { + "git.defaultCloneDirectory": { "type": "string", "default": null, - "description": "%config.cloneDirectory%" + "description": "%config.defaultCloneDirectory%" } } } diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 270283993d4..81188ab18a3 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -38,5 +38,5 @@ "config.checkoutType": "Controls what type of branches are listed when running `Checkout to...`. `all` shows all refs, `local` shows only the local branchs, `tags` shows only tags and `remote` shows only remote branches.", "config.ignoreLegacyWarning": "Ignores the legacy Git warning", "config.ignoreLimitWarning": "Ignores the warning when there are too many changes in a repository", - "config.cloneDirectory": "When cloning a new repository, the default location will be set to this directory" + "config.defaultCloneDirectory": "The default location where to clone a git repository" } \ No newline at end of file diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index a938cb31197..5f2ea323c1c 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -203,11 +203,11 @@ export class CommandCenter { } const config = workspace.getConfiguration('git'); - const cloneDirectory = config.get('cloneDirectory') || os.homedir(); + const value = config.get('defaultCloneDirectory') || os.homedir(); const parentPath = await window.showInputBox({ prompt: localize('parent', "Parent Directory"), - value: cloneDirectory, + value, ignoreFocusOut: true }); diff --git a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts index 0bdf195f96c..e35495db433 100644 --- a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts +++ b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts @@ -235,11 +235,6 @@ export function registerContributions(): void { enum: ['all', 'local', 'tags', 'remote'], default: 'all', description: nls.localize('checkoutType', "Controls what type of branches are listed."), - }, - 'git.cloneDirectory': { - type: 'string', - default: null, - description: nls.localize('cloneDirectory', "When cloning a new repository, the default location will be set to this directory."), } } });