aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorEiso Kant <contact@eisokant.com>2017-11-29 16:01:49 +0100
committerGitHub <noreply@github.com>2017-11-29 16:01:49 +0100
commit63df18183b9926a1465ca6235f97a237e252accd (patch)
tree0cdffb9ec60429bdec2230b3f03a70c60c3fb943 /README.md
parentf9879dd043f84936a1f8acb8a53b74332a7ae135 (diff)
downloadgo-git-63df18183b9926a1465ca6235f97a237e252accd.tar.gz
Updating the outdated 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 0ba97cd..e195eec 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: