Skip to content

Commit

Permalink
GitTools#1115 - disable git extension for worktreeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Jul 9, 2024
1 parent f72dc8b commit 35381cf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tools/gitversion/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
const settings = this.settingsProvider.getGitVersionSettings()
const workDir = this.getRepoDir(settings)

await this.disableGitExtensionWorkTreeConfig(workDir)
await this.checkShallowClone(settings, workDir)

const args = this.getArguments(workDir, settings)
Expand Down Expand Up @@ -209,8 +210,16 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
}
}

private async disableGitExtensionWorkTreeConfig(workDir: string): Promise<void> {
// git config --unset-all extensions.worktreeconfig
const result = await this.execute('git', ['-C', workDir, 'config', '--unset-all', 'extensions.worktreeconfig'])
if (result.code !== 0) {
throw new Error('Failed to disable git extension worktreeconfig')
}
}

private toCamelCase(input: string): string {
return input.replace(/^\w|[A-Z]|\b\w|\s+/g, function (match, index) {
return input.replace(/^\w|[A-Z]|\b\w|\s+/g, function(match, index) {
if (+match === 0) return '' // or if (/\s+/.test(match)) for white spaces
return index === 0 ? match.toLowerCase() : match.toUpperCase()
})
Expand Down

0 comments on commit 35381cf

Please sign in to comment.