I have following code
commitIter, err := r.Log(&git.LogOptions{From: commit.Hash})
CheckIfError(err)
err = commitIter.ForEach(func(c *object.Commit) error {
parent, err := c.Parent(0)
if err != nil {
return nil
}
patch, err := c.Patch(parent)
CheckIfError(err)
fmt.Println(patch)
return nil
})
it iterates over all commits and generates patch for each of them, using reference to parent. But first commit doesn't have parent then I can't generate patch. Is there any workaround like passing empty commit?
I was searching and I found open pull request on archived go-git
repository.