Skip to content

Commit ec2de50

Browse files
committed
feat(git): clone hidden refs
1 parent 0427985 commit ec2de50

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

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

0 commit comments

Comments
 (0)