aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-15 03:51:04 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-15 03:51:04 +0200
commitbcb49927a3897eadc29960032c70da29e26d6b58 (patch)
tree60025a0a59d15e49c6027b1bfd5d6fee5d5d2438 /examples
parentf6fe29c80d11662a169806dcf413ecdedcb28fa3 (diff)
downloadgo-git-bcb49927a3897eadc29960032c70da29e26d6b58.tar.gz
Repository.Clone and Remote.Fetch remote, local branches and client: correct header read
Diffstat (limited to 'examples')
-rw-r--r--examples/basic/main.go7
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)
}