Skip to content

Find, verify, and analyze leaked credentials

feature flag additional refs (#3282)

Dustin Decker70c6bb56345b
diff --git a/pkg/feature/feature.go b/pkg/feature/feature.go
index 59ec82403..cd4669247 100644
--- a/pkg/feature/feature.go
+++ b/pkg/feature/feature.go
@@ -3,6 +3,7 @@ package feature
import "sync/atomic"
var (
- ForceSkipBinaries = atomic.Bool{}
- ForceSkipArchives = atomic.Bool{}
+ ForceSkipBinaries = atomic.Bool{}
+ ForceSkipArchives = atomic.Bool{}
+ SkipAdditionalRefs = atomic.Bool{}
)
diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go
index b98cadbee..23a69f6cf 100644
--- a/pkg/sources/git/git.go
+++ b/pkg/sources/git/git.go
@@ -420,10 +420,13 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
"clone",
cloneURL.String(),
params.clonePath,
- "-c",
- "remote.origin.fetch=+refs/*:refs/remotes/origin/*",
"--quiet", // https://git-scm.com/docs/git-clone#Documentation/git-clone.txt-code--quietcode
}
+ if !feature.SkipAdditionalRefs.Load() {
+ gitArgs = append(gitArgs,
+ "-c",
+ "remote.origin.fetch=+refs/*:refs/remotes/origin/*")
+ }
gitArgs = append(gitArgs, params.args...)
cloneCmd := exec.Command("git", gitArgs...)