From 9b8f1cb437c30d959b3fbc6fe975a52cd686c2e2 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 19 Jun 2023 12:42:30 +0200 Subject: [PATCH] Git - only add default branch name if supported (#185557) --- extensions/git/package.json | 4 ++-- extensions/git/package.nls.json | 4 ++-- extensions/git/src/git.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index e9e667dcc33..c75c165c503 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -2082,7 +2082,7 @@ }, "git.defaultBranchName": { "type": "string", - "description": "%config.defaultBranchName%", + "markdownDescription": "%config.defaultBranchName%", "default": "main", "scope": "resource" }, @@ -2719,7 +2719,7 @@ "default": 50, "minimum": 0, "maximum": 100, - "description": "%config.similarityThreshold%", + "markdownDescription": "%config.similarityThreshold%", "scope": "resource" } } diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 89bd6b522fa..74386ba1464 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -132,7 +132,7 @@ "config.checkoutType.local": "Local branches", "config.checkoutType.tags": "Tags", "config.checkoutType.remote": "Remote branches", - "config.defaultBranchName": "The name of the default branch (ex: main, trunk, development) when initializing a new git repository. When set to empty, the default branch name configured in git will be used.", + "config.defaultBranchName": "The name of the default branch (ex: main, trunk, development) when initializing a new git repository. When set to empty, the default branch name configured in git will be used. **Note:** Requires git version `2.28.0` or later.", "config.branchPrefix": "Prefix used when creating a new branch.", "config.branchProtection": "List of protected branches. By default, a prompt is shown before changes are committed to a protected branch. The prompt can be controlled using the `#git.branchProtectionPrompt#` setting.", "config.branchProtectionPrompt": "Controls whether a prompt is being shown before changes are committed to a protected branch.", @@ -253,7 +253,7 @@ "config.publishBeforeContinueOn.always": "Always publish unpublished git state when using Continue Working On from a git repository", "config.publishBeforeContinueOn.never": "Never publish unpublished git state when using Continue Working On from a git repository", "config.publishBeforeContinueOn.prompt": "Prompt to publish unpublished git state when using Continue Working On from a git repository", - "config.similarityThreshold": "Controls the threshold of the similarity index (i.e. amount of additions/deletions compared to the file's size) for changes in a pair of added/deleted files to be considered a rename.", + "config.similarityThreshold": "Controls the threshold of the similarity index (i.e. amount of additions/deletions compared to the file's size) for changes in a pair of added/deleted files to be considered a rename. **Note:** Requires git version `2.18.0` or later.", "submenu.explorer": "Git", "submenu.commit": "Commit", "submenu.commit.amend": "Amend", diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index a5a9589dcc4..d0412aec7f7 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -404,7 +404,7 @@ export class Git { async init(repository: string, options: InitOptions = {}): Promise { const args = ['init']; - if (options.defaultBranch && options.defaultBranch !== '') { + if (options.defaultBranch && options.defaultBranch !== '' && this.compareGitVersionTo('2.28.0') !== -1) { args.push('-b', options.defaultBranch); }