Git - only add default branch name if supported (#185557)

This commit is contained in:
Ladislau Szomoru 2023-06-19 12:42:30 +02:00 committed by GitHub
parent b8a3395fed
commit 9b8f1cb437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -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"
}
}

View file

@ -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",

View file

@ -404,7 +404,7 @@ export class Git {
async init(repository: string, options: InitOptions = {}): Promise<void> {
const args = ['init'];
if (options.defaultBranch && options.defaultBranch !== '') {
if (options.defaultBranch && options.defaultBranch !== '' && this.compareGitVersionTo('2.28.0') !== -1) {
args.push('-b', options.defaultBranch);
}