Add clean-exclude input

This allows clients to ignore specific paths from the clean phase of the
checkout.
This commit is contained in:
Matthew Endsley 2022-10-28 20:20:33 -07:00
parent 925b9fdcfa
commit 0f6c54dea3
8 changed files with 38 additions and 9 deletions

View file

@ -42,7 +42,7 @@ export interface IGitCommandManager {
submoduleSync(recursive: boolean): Promise<void>
submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void>
tagExists(pattern: string): Promise<boolean>
tryClean(): Promise<boolean>
tryClean(exclude: string[]): Promise<boolean>
tryConfigUnset(configKey: string, globalConfig?: boolean): Promise<boolean>
tryDisableAutomaticGarbageCollection(): Promise<boolean>
tryGetFetchUrl(): Promise<string>
@ -331,8 +331,14 @@ class GitCommandManager {
return !!output.stdout.trim()
}
async tryClean(): Promise<boolean> {
const output = await this.execGit(['clean', '-ffdx'], true)
async tryClean(exclude: string[]): Promise<boolean> {
var cleanArgs: string[] = []
for (const pattern of exclude) {
cleanArgs.push('-e')
cleanArgs.push(pattern)
}
const output = await this.execGit(['clean', '-ffdx', ...cleanArgs], true)
return output.exitCode === 0
}