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.
This commit is contained in:
Chuan-kai Lin
2024-12-09 08:07:22 -08:00
parent 70aac4e018
commit dd4aa40016

View File

@@ -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 {