Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 94f5e9c

Browse files
weirdgiraffemcuadros
authored andcommitted
fix package documentation (#109)
update example code to actual go-git.v4
1 parent 1918bfe commit 94f5e9c

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

doc.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,31 @@
66
// extensions.
77
//
88
// Small example extracting the commits from a repository:
9-
// func ExampleBasic_printCommits() {
10-
// r, err := git.NewRepository("https://github.com/src-d/go-git", nil)
11-
// if err != nil {
12-
// panic(err)
13-
// }
9+
// func ExampleBasic_printCommits() {
10+
// r := git.NewMemoryRepository()
11+
// o := &git.CloneOptions{
12+
// URL: "https://github.com/src-d/go-git",
13+
// }
14+
// if err := r.Clone(o); err != nil {
15+
// panic(err)
16+
// }
1417
//
15-
// if err := r.Pull("origin", "refs/heads/master"); err != nil {
16-
// panic(err)
17-
// }
18+
// iter, err := r.Commits()
19+
// if err != nil {
20+
// panic(err)
21+
// }
22+
// defer iter.Close()
1823
//
19-
// iter := r.Commits()
20-
// defer iter.Close()
24+
// for {
25+
// commit, err := iter.Next()
26+
// if err != nil {
27+
// if err == io.EOF {
28+
// break
29+
// }
30+
// panic(err)
31+
// }
2132
//
22-
// for {
23-
// commit, err := iter.Next()
24-
// if err != nil {
25-
// if err == io.EOF {
26-
// break
27-
// }
28-
//
29-
// panic(err)
30-
// }
31-
//
32-
// fmt.Println(commit)
33-
// }
33+
// fmt.Println(commit)
3434
// }
35+
// }
3536
package git // import "gopkg.in/src-d/go-git.v4"

0 commit comments

Comments
 (0)