mirror of
https://github.com/actions/checkout.git
synced 2025-07-13 20:50:45 +00:00
Add sparse checkout support
This commit is contained in:
parent
230611dbd0
commit
ad6eac3f6b
11 changed files with 128 additions and 0 deletions
|
@ -38,6 +38,7 @@ export interface IGitCommandManager {
|
|||
revParse(ref: string): Promise<string>
|
||||
setEnvironmentVariable(name: string, value: string): void
|
||||
shaExists(sha: string): Promise<boolean>
|
||||
sparseCheckout(cone: boolean, paths: string[]): Promise<void>
|
||||
submoduleForeach(command: string, recursive: boolean): Promise<string>
|
||||
submoduleSync(recursive: boolean): Promise<void>
|
||||
submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void>
|
||||
|
@ -292,6 +293,19 @@ class GitCommandManager {
|
|||
return output.exitCode === 0
|
||||
}
|
||||
|
||||
async sparseCheckout(cone: boolean, paths: string[]): Promise<void> {
|
||||
const args1 = ['sparse-checkout', 'init']
|
||||
|
||||
if (cone) {
|
||||
args1.push('--cone')
|
||||
}
|
||||
|
||||
const args2 = ['sparse-checkout', 'set', '--', ...paths]
|
||||
|
||||
await this.execGit(args1)
|
||||
await this.execGit(args2)
|
||||
}
|
||||
|
||||
async submoduleForeach(command: string, recursive: boolean): Promise<string> {
|
||||
const args = ['submodule', 'foreach']
|
||||
if (recursive) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue