fix: use --fixed-value flag when unsetting git config values

The tryConfigUnsetValue method was passing file paths directly to
`git config --unset`, which treats the value argument as an extended
regular expression. File paths contain `.` characters that would match
any character instead of literal periods, potentially causing incorrect
matches.

Adding the --fixed-value flag ensures the value is treated as a literal
string, fixing credential config cleanup in the v6-style authentication.
This commit is contained in:
Peter Evans 2026-01-21 17:59:11 +00:00
parent 2df30281e1
commit 64240115db
2 changed files with 4 additions and 2 deletions

4
dist/index.js vendored
View file

@ -979,7 +979,9 @@ class GitCommandManager {
else { else {
args.push(globalConfig ? '--global' : '--local'); args.push(globalConfig ? '--global' : '--local');
} }
args.push('--unset', configKey, configValue); // Use --fixed-value to treat configValue as a literal string, not a regex pattern.
// This is important for file paths which contain regex special characters like '.'
args.push('--fixed-value', '--unset', configKey, configValue);
const output = yield this.exec(args, { allowAllExitCodes: true }); const output = yield this.exec(args, { allowAllExitCodes: true });
return output.exitCode === 0; return output.exitCode === 0;
}); });

View file

@ -368,7 +368,7 @@ export class GitCommandManager {
} else { } else {
args.push(globalConfig ? '--global' : '--local') args.push(globalConfig ? '--global' : '--local')
} }
args.push('--unset', configKey, configValue) args.push('--fixed-value', '--unset', configKey, configValue)
const output = await this.exec(args, {allowAllExitCodes: true}) const output = await this.exec(args, {allowAllExitCodes: true})
return output.exitCode === 0 return output.exitCode === 0
} }