From 63df18183b9926a1465ca6235f97a237e252accd Mon Sep 17 00:00:00 2001 From: Eiso Kant Date: Wed, 29 Nov 2017 16:01:49 +0100 Subject: Updating the outdated example to the new one --- README.md | 13 ++++++------- 1 file 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: -- cgit