aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-11-29 20:37:48 +0100
committerGitHub <noreply@github.com>2017-11-29 20:37:48 +0100
commit174fd8e5b2150dbd4cf522bb4a98fb9d79ebc6f4 (patch)
treed2cd921efda7c7efd3338a594ecccbd8b0220c20 /README.md
parent7ced03216a47327d64f68c750114a96cfcbae38b (diff)
parent63df18183b9926a1465ca6235f97a237e252accd (diff)
downloadgo-git-174fd8e5b2150dbd4cf522bb4a98fb9d79ebc6f4.tar.gz
Merge pull request #668 from src-d/eiso-patch-1
Updating the outdated README example to the new one
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 6 insertions, 7 deletions
diff --git a/README.md b/README.md
index 86c7634..bd22288 100644
--- a/README.md
+++ b/README.md
@@ -76,18 +76,17 @@ Info("git log")
ref, err := r.Head()
CheckIfError(err)
-// ... retrieves the commit object
-commit, err := r.CommitObject(ref.Hash())
-CheckIfError(err)
// ... retrieves the commit history
-history, err := commit.History()
+cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
CheckIfError(err)
// ... just iterates over the commits, printing it
-for _, c := range history {
- fmt.Println(c)
-}
+err = cIter.ForEach(func(c *object.Commit) error {
+ fmt.Println(c)
+ return nil
+})
+CheckIfError(err)
```
Outputs: