diff options
author | Eiso Kant <contact@eisokant.com> | 2017-11-29 16:01:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-29 16:01:49 +0100 |
commit | 63df18183b9926a1465ca6235f97a237e252accd (patch) | |
tree | 0cdffb9ec60429bdec2230b3f03a70c60c3fb943 /README.md | |
parent | f9879dd043f84936a1f8acb8a53b74332a7ae135 (diff) | |
download | go-git-63df18183b9926a1465ca6235f97a237e252accd.tar.gz |
Updating the outdated example to the new one
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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: |