diff options
Diffstat (limited to 'examples/basic')
-rw-r--r-- | examples/basic/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/basic/main.go b/examples/basic/main.go index fd7f82e..e13b5d9 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -16,7 +16,7 @@ func main() { panic(err) } - if err = r.Clone(&git.CloneOptions{URL: url}); err != nil { + if err = r.Clone(&git.RepositoryCloneOptions{URL: url, Depth: 1, SingleBranch: false}); err != nil { panic(err) } @@ -24,8 +24,10 @@ func main() { if err != nil { panic(err) } + defer iter.Close() + var count = 0 for { //the commits are not shorted in any special order commit, err := iter.Next() @@ -37,6 +39,9 @@ func main() { panic(err) } + count++ fmt.Println(commit) } + + fmt.Println("total commits:", count) } |