This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-22
lines changed Expand file tree Collapse file tree 1 file changed +23
-22
lines changed Original file line number Diff line number Diff line change 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+ // }
3536package git // import "gopkg.in/src-d/go-git.v4"
You can’t perform that action at this time.
0 commit comments