Skip to content

Commit

Permalink
Git - handle files that contain [ in their name when adding to .git…
Browse files Browse the repository at this point in the history
…ignore (#224777)
  • Loading branch information
lszomoru authored Aug 5, 2024
1 parent 39d9860 commit dad736b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,8 @@ export class Repository implements Disposable {
return await this.run(Operation.Ignore, async () => {
const ignoreFile = `${this.repository.root}${path.sep}.gitignore`;
const textToAppend = files
.map(uri => relativePath(this.repository.root, uri.fsPath).replace(/\\/g, '/'))
.map(uri => relativePath(this.repository.root, uri.fsPath)
.replace(/\\|\[/g, match => match === '\\' ? '/' : `\\${match}`))
.join('\n');

const document = await new Promise(c => fs.exists(ignoreFile, c))
Expand Down

0 comments on commit dad736b

Please sign in to comment.