From dd4aa4001611aec63fcf35ffc8b2d81d69f121fc Mon Sep 17 00:00:00 2001 From: Chuan-kai Lin Date: Mon, 9 Dec 2024 08:07:22 -0800 Subject: [PATCH] deepenGitHistory: specify HEAD This commit makes deepenGitHistory pass "origin HEAD" to Git fetch, which prevents Git from fetching all branches that are present in the remote repository. --- src/actions-util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions-util.ts b/src/actions-util.ts index 2cfba5f35..99da81262 100644 --- a/src/actions-util.ts +++ b/src/actions-util.ts @@ -163,7 +163,7 @@ export const determineBaseBranchHeadCommitOid = async function ( }; /** - * Deepen the git history of the given ref by one level. Errors are logged. + * Deepen the git history of HEAD by one level. Errors are logged. * * This function uses the `checkout_path` to determine the repository path and * works only when called from `analyze` or `upload-sarif`. @@ -172,7 +172,7 @@ export const deepenGitHistory = async function () { try { await runGitCommand( getOptionalInput("checkout_path"), - ["fetch", "--no-tags", "--deepen=1"], + ["fetch", "origin", "HEAD", "--no-tags", "--deepen=1"], "Cannot deepen the shallow repository.", ); } catch {