aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/repo.go')
-rw-r--r--modules/git/repo.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index e277f896bf..03296d56ab 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -161,6 +161,7 @@ type CloneRepoOptions struct {
Branch string
Shared bool
NoCheckout bool
+ Depth int
}
// Clone clones original repository to target path.
@@ -193,6 +194,9 @@ func CloneWithArgs(from, to string, args []string, opts CloneRepoOptions) (err e
if opts.NoCheckout {
cmd.AddArguments("--no-checkout")
}
+ if opts.Depth > 0 {
+ cmd.AddArguments("--depth", strconv.Itoa(opts.Depth))
+ }
if len(opts.Branch) > 0 {
cmd.AddArguments("-b", opts.Branch)