From 819730283a024fbe7dc0f9ecad7225068f49d369 Mon Sep 17 00:00:00 2001 From: parker-michel-vanta Date: Wed, 16 Jul 2025 10:33:10 -0400 Subject: [PATCH] updates --- README.md | 7 ++++--- src/git-command-manager.ts | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6a468b0..32785ec 100644 --- a/README.md +++ b/README.md @@ -110,8 +110,12 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/ sparse-checkout-cone-mode: '' # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Default: 1 fetch-depth: '' + # Date like `2days` or `1970-01-01`. Fetch a history after the specified time. + shallow-since: '' + # Whether to fetch tags, even if fetch-depth > 0. # Default: false fetch-tags: '' @@ -120,9 +124,6 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/ # Default: true show-progress: '' - # Date like `2days` or `1970-01-01`. Fetch a history after the specified time. - shallow-since: '' - # Whether to download Git-LFS files # Default: false lfs: '' diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index c157f57..5c5ec2a 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -33,16 +33,13 @@ export interface IGitCommandManager { configExists(configKey: string, globalConfig?: boolean): Promise fetch( refSpec: string[], - fetchDepth?: number, - shallowSince?: string, options: { - filter?: string, - fetchDepth?: number, - shallowSince?: string, - fetchTags?: boolean, + filter?: string + fetchDepth?: number + shallowSince?: string + fetchTags?: boolean showProgress?: boolean } - ): Promise getDefaultBranch(repositoryUrl: string): Promise getWorkingDirectory(): string @@ -58,6 +55,7 @@ export interface IGitCommandManager { shaExists(sha: string): Promise submoduleForeach(command: string, recursive: boolean): Promise submoduleSync(recursive: boolean): Promise + submoduleStatus(): Promise submoduleUpdate( fetchDepth: number, recursive: boolean, @@ -262,8 +260,8 @@ class GitCommandManager { refSpec: string[], options: { filter?: string - fetchDepth?: number, - shallowSince?: string, + fetchDepth?: number + shallowSince?: string fetchTags?: boolean showProgress?: boolean } @@ -284,7 +282,9 @@ class GitCommandManager { if (options.shallowSince) { args.push(`--shallow-since=${options.shallowSince}`) - } else if (options.fetchDepth && options.fetchDepth > 0) { + } + + if (options.fetchDepth && options.fetchDepth > 0) { args.push(`--depth=${options.fetchDepth}`) } else if ( fshelper.fileExistsSync( @@ -429,6 +429,7 @@ class GitCommandManager { if (fetchDepth > 0) { args.push(`--depth=${fetchDepth}`) } + if (shallowSince) { args.push(`--shallow-since=${shallowSince}`) }