Add GitShallowClone feature
This feature enables the use of shallow clones when pulling source from Git repositories. Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
parent
6d639f3bcd
commit
e846e29458
|
@ -298,6 +298,10 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
|
|||
opts.Branch = ref.Branch
|
||||
}
|
||||
|
||||
if enabled, _ := r.features[features.GitShallowClone]; enabled {
|
||||
opts.ShallowClone = true
|
||||
}
|
||||
|
||||
// Use the git operations timeout for the repo.
|
||||
cloneCtx, cancel := context.WithTimeout(ctx, origin.Spec.Timeout.Duration)
|
||||
defer cancel()
|
||||
|
|
|
@ -32,6 +32,10 @@ const (
|
|||
// When enabled, libgit2 won't be initialized, nor will any git2go cgo
|
||||
// code be called.
|
||||
ForceGoGitImplementation = "ForceGoGitImplementation"
|
||||
|
||||
// GitShallowClone enables the use of shallow clones when pulling source from
|
||||
// Git repositories.
|
||||
GitShallowClone = "GitShallowClone"
|
||||
)
|
||||
|
||||
var features = map[string]bool{
|
||||
|
@ -42,6 +46,10 @@ var features = map[string]bool{
|
|||
// ForceGoGitImplementation
|
||||
// opt-out from v0.27
|
||||
ForceGoGitImplementation: true,
|
||||
|
||||
// GitShallowClone
|
||||
// opt-in from v0.28
|
||||
GitShallowClone: false,
|
||||
}
|
||||
|
||||
// DefaultFeatureGates contains a list of all supported feature gates and
|
||||
|
|
Loading…
Reference in New Issue