Skip to content

Commit 9b8f1cb

Browse files
authored
Git - only add default branch name if supported (microsoft#185557)
1 parent b8a3395 commit 9b8f1cb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

extensions/git/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@
20822082
},
20832083
"git.defaultBranchName": {
20842084
"type": "string",
2085-
"description": "%config.defaultBranchName%",
2085+
"markdownDescription": "%config.defaultBranchName%",
20862086
"default": "main",
20872087
"scope": "resource"
20882088
},
@@ -2719,7 +2719,7 @@
27192719
"default": 50,
27202720
"minimum": 0,
27212721
"maximum": 100,
2722-
"description": "%config.similarityThreshold%",
2722+
"markdownDescription": "%config.similarityThreshold%",
27232723
"scope": "resource"
27242724
}
27252725
}

extensions/git/package.nls.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"config.checkoutType.local": "Local branches",
133133
"config.checkoutType.tags": "Tags",
134134
"config.checkoutType.remote": "Remote branches",
135-
"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.",
135+
"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.",
136136
"config.branchPrefix": "Prefix used when creating a new branch.",
137137
"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.",
138138
"config.branchProtectionPrompt": "Controls whether a prompt is being shown before changes are committed to a protected branch.",
@@ -253,7 +253,7 @@
253253
"config.publishBeforeContinueOn.always": "Always publish unpublished git state when using Continue Working On from a git repository",
254254
"config.publishBeforeContinueOn.never": "Never publish unpublished git state when using Continue Working On from a git repository",
255255
"config.publishBeforeContinueOn.prompt": "Prompt to publish unpublished git state when using Continue Working On from a git repository",
256-
"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.",
256+
"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.",
257257
"submenu.explorer": "Git",
258258
"submenu.commit": "Commit",
259259
"submenu.commit.amend": "Amend",

extensions/git/src/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export class Git {
404404
async init(repository: string, options: InitOptions = {}): Promise<void> {
405405
const args = ['init'];
406406

407-
if (options.defaultBranch && options.defaultBranch !== '') {
407+
if (options.defaultBranch && options.defaultBranch !== '' && this.compareGitVersionTo('2.28.0') !== -1) {
408408
args.push('-b', options.defaultBranch);
409409
}
410410

0 commit comments

Comments
 (0)