Exclude path from clean

This commit is contained in:
Gregory Bonaert 2025-04-09 17:24:36 +02:00
parent 85e6279cec
commit 9a73efb9ba
6 changed files with 28 additions and 5 deletions

View file

@ -57,7 +57,7 @@ export interface IGitCommandManager {
submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void>
submoduleStatus(): Promise<boolean>
tagExists(pattern: string): Promise<boolean>
tryClean(): Promise<boolean>
tryClean(exclude_from_clean: string | undefined): Promise<boolean>
tryConfigUnset(configKey: string, globalConfig?: boolean): Promise<boolean>
tryDisableAutomaticGarbageCollection(): Promise<boolean>
tryGetFetchUrl(): Promise<string>
@ -434,8 +434,13 @@ class GitCommandManager {
return !!output.stdout.trim()
}
async tryClean(): Promise<boolean> {
const output = await this.execGit(['clean', '-ffdx'], true)
async tryClean(exclude_from_clean: string | undefined): Promise<boolean> {
let output
if (exclude_from_clean === undefined) {
output = await this.execGit(['clean', '-ffdx'], true)
} else {
output = await this.execGit(['clean', '-ffdx', '-e', exclude_from_clean], true)
}
return output.exitCode === 0
}