Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 63df181

Browse files
authored
Updating the outdated example to the new one
1 parent f9879dd commit 63df181

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,17 @@ Info("git log")
7676
ref, err := r.Head()
7777
CheckIfError(err)
7878

79-
// ... retrieves the commit object
80-
commit, err := r.CommitObject(ref.Hash())
81-
CheckIfError(err)
8279

8380
// ... retrieves the commit history
84-
history, err := commit.History()
81+
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
8582
CheckIfError(err)
8683

8784
// ... just iterates over the commits, printing it
88-
for _, c := range history {
89-
fmt.Println(c)
90-
}
85+
err = cIter.ForEach(func(c *object.Commit) error {
86+
fmt.Println(c)
87+
return nil
88+
})
89+
CheckIfError(err)
9190
```
9291

9392
Outputs:

0 commit comments

Comments
 (0)