From 7cb8af2117e4480eef857b47dc88e3b3000a1e3e Mon Sep 17 00:00:00 2001 From: Richard Gomez Date: Wed, 18 Oct 2023 17:18:58 -0400 Subject: [PATCH] feat(git): clone hidden refs --- pkg/sources/git/git.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go index 870cec356bf5..d44e03e33107 100644 --- a/pkg/sources/git/git.go +++ b/pkg/sources/git/git.go @@ -417,7 +417,13 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err cloneURL.User = params.userInfo } - gitArgs := []string{"clone", cloneURL.String(), params.clonePath} + gitArgs := []string{ + "clone", cloneURL.String(), params.clonePath, + // Fetch additional refs from GitHub and GitLab. + // https://github.com/trufflesecurity/trufflehog/issues/1588 + "-c", "remote.origin.fetch=+refs/pull/*:refs/heads/pull/*", + "-c", "remote.origin.fetch=+refs/merge-requests/*:refs/heads/merge-requests/*", + } gitArgs = append(gitArgs, params.args...) cloneCmd := exec.Command("git", gitArgs...)