diff options
-rw-r--r-- | doc.go | 45 |
1 files changed, 23 insertions, 22 deletions
@@ -6,30 +6,31 @@ // extensions. // // Small example extracting the commits from a repository: -// func ExampleBasic_printCommits() { -// r, err := git.NewRepository("https://github.com/src-d/go-git", nil) -// if err != nil { -// panic(err) -// } +// func ExampleBasic_printCommits() { +// r := git.NewMemoryRepository() +// o := &git.CloneOptions{ +// URL: "https://github.com/src-d/go-git", +// } +// if err := r.Clone(o); err != nil { +// panic(err) +// } // -// if err := r.Pull("origin", "refs/heads/master"); err != nil { -// panic(err) -// } +// iter, err := r.Commits() +// if err != nil { +// panic(err) +// } +// defer iter.Close() // -// iter := r.Commits() -// defer iter.Close() +// for { +// commit, err := iter.Next() +// if err != nil { +// if err == io.EOF { +// break +// } +// panic(err) +// } // -// for { -// commit, err := iter.Next() -// if err != nil { -// if err == io.EOF { -// break -// } -// -// panic(err) -// } -// -// fmt.Println(commit) -// } +// fmt.Println(commit) // } +// } package git // import "gopkg.in/src-d/go-git.v4" |