Skip to content

Commit 438418c

Browse files
committed
feat(git): clone hidden refs
1 parent 76fcdae commit 438418c

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
@@ -374,7 +374,13 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
374374
cloneURL.User = params.userInfo
375375
}
376376

377-
gitArgs := []string{"clone", cloneURL.String(), params.clonePath}
377+
gitArgs := []string{
378+
"clone", cloneURL.String(), params.clonePath,
379+
// Fetch additional refs from GitHub and GitLab.
380+
// https://github.com/trufflesecurity/trufflehog/issues/1588
381+
"-c", "remote.origin.fetch=+refs/pull/*:refs/heads/pull/*",
382+
"-c", "remote.origin.fetch=+refs/merge-requests/*:refs/heads/merge-requests/*",
383+
}
378384
gitArgs = append(gitArgs, params.args...)
379385
cloneCmd := exec.Command("git", gitArgs...)
380386

0 commit comments

Comments
 (0)