Skip to content

Commit f64e0a3

Browse files
committed
feat(git): clone hidden refs
1 parent 4b821e9 commit f64e0a3

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
@@ -356,7 +356,13 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
356356
cloneURL.User = params.userInfo
357357
}
358358

359-
gitArgs := []string{"clone", cloneURL.String(), params.clonePath}
359+
gitArgs := []string{
360+
"clone", cloneURL.String(), params.clonePath,
361+
// Fetch additional refs from GitHub and GitLab.
362+
// https://github.com/trufflesecurity/trufflehog/issues/1588
363+
"-c", "remote.origin.fetch=+refs/pull/*:refs/heads/pull/*",
364+
"-c", "remote.origin.fetch=+refs/merge-requests/*:refs/heads/merge-requests/*",
365+
}
360366
gitArgs = append(gitArgs, params.args...)
361367
cloneCmd := exec.Command("git", gitArgs...)
362368

0 commit comments

Comments
 (0)