Apply filter options to submodule update

Fixes: https://github.com/actions/checkout/issues/1714
This commit is contained in:
Scott Talbert 2026-07-07 19:47:58 -04:00
parent e8d4307400
commit 057e2c1f09
4 changed files with 90 additions and 5 deletions

View file

@ -55,7 +55,11 @@ export interface IGitCommandManager {
shaExists(sha: string): Promise<boolean>
submoduleForeach(command: string, recursive: boolean): Promise<string>
submoduleSync(recursive: boolean): Promise<void>
submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void>
submoduleUpdate(
fetchDepth: number,
recursive: boolean,
filter: string | undefined
): Promise<void>
submoduleStatus(): Promise<boolean>
tagExists(pattern: string): Promise<boolean>
tryClean(): Promise<boolean>
@ -452,7 +456,11 @@ class GitCommandManager {
await this.execGit(args)
}
async submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> {
async submoduleUpdate(
fetchDepth: number,
recursive: boolean,
filter: string | undefined
): Promise<void> {
const args = ['-c', 'protocol.version=2']
args.push('submodule', 'update', '--init', '--force')
if (fetchDepth > 0) {
@ -463,6 +471,10 @@ class GitCommandManager {
args.push('--recursive')
}
if (filter) {
args.push(`--filter=${filter}`)
}
await this.execGit(args)
}