MCPcopy Create free account
hub / github.com/JanSmrcka/differ / CommitDiff

Method CommitDiff

internal/git/repo.go:295–302  ·  view source on GitHub ↗

CommitDiff returns the full diff for a commit. For the root commit (no parent), uses diff-tree against empty tree.

(hash string)

Source from the content-addressed store, hash-verified

293// CommitDiff returns the full diff for a commit.
294// For the root commit (no parent), uses diff-tree against empty tree.
295func (r *Repo) CommitDiff(hash string) (string, error) {
296 out, err := r.run("diff", hash+"~1", hash, "--no-ext-diff", "--color=never")
297 if err != nil {
298 // Root commit — diff against empty tree
299 return r.run("diff-tree", "-p", "--root", "--no-ext-diff", "--color=never", hash)
300 }
301 return out, nil
302}
303
304// CommitDiffFiles returns files changed in a commit.
305func (r *Repo) CommitDiffFiles(hash string) ([]FileChange, error) {

Callers 2

TestCommitDiffFunction · 0.80
loadCommitDiffMethod · 0.80

Calls 1

runMethod · 0.95

Tested by 1

TestCommitDiffFunction · 0.64