Skip to content

Commit 3fb6641

Browse files
rgmzRichard Gomez
authored andcommitted
feat(git): clone hidden refs
1 parent 94a1653 commit 3fb6641

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/sources/git/git.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,13 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
417417
cloneURL.User = params.userInfo
418418
}
419419

420-
gitArgs := []string{"clone", cloneURL.String(), params.clonePath}
420+
gitArgs := []string{
421+
"clone", cloneURL.String(), params.clonePath,
422+
// Fetch additional refs from GitHub and GitLab.
423+
// https://github.com/trufflesecurity/trufflehog/issues/1588
424+
"-c", "remote.origin.fetch=+refs/pull/*:refs/heads/pull/*",
425+
"-c", "remote.origin.fetch=+refs/merge-requests/*:refs/heads/merge-requests/*",
426+
}
421427
gitArgs = append(gitArgs, params.args...)
422428
cloneCmd := exec.Command("git", gitArgs...)
423429

0 commit comments

Comments
 (0)