-
Notifications
You must be signed in to change notification settings - Fork 538
Patch: Fetch changes #1102
Comments
I have made progress in implementing This implementation has been quite helpful. func (c *Commit) Stats() (FileStats, error) {
// Get the previous commit.
ci := c.Parents()
parentCommit, err := ci.Next()
if err != nil {
if err == io.EOF {
emptyNoder := treeNoder{}
parentCommit = &Commit{
Hash: emptyNoder.hash,
// TreeHash: emptyNoder.parent.Hash,
s: c.s,
}
} else {
return nil, err
}
}
patch, err := parentCommit.Patch(c)
if err != nil {
return nil, err
}
return getFileStatsFromFilePatches(patch.FilePatches()), nil
} Sadly stats for the first commit (without a parent) returns Also creating a dummy parent commit outside the package is quite difficult because So how can I fetch stats/changes in a commit without a parent? |
It's interesting that |
@mcuadros Sorry for the direct mention, but it seems like there must be a simple way to get the initial commit patch diff that I'm just not seeing. How would you suggest handling this? |
This was solved here: #1115 |
How can I be able to implement
git log -p --reverse
using this tool?The text was updated successfully, but these errors were encountered: