diff options
author | Alberto Cortés <alcortesm@gmail.com> | 2017-02-21 10:24:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 10:24:10 +0100 |
commit | 0b8b8da617d5a077f282e57d0300dc106a604236 (patch) | |
tree | f481480a0311764e2a306e079b48b5f9d33bc304 /Makefile | |
parent | efe9ecf9a2b4d9346a1ae105210b4dabb26aa2a8 (diff) | |
download | go-git-0b8b8da617d5a077f282e57d0300dc106a604236.tar.gz |
difftree for git.Trees (#273)
Last PR to fix #82:
This PR modifies the difftree package itself. The old version extracted the files in both trees and compare them by hand. The new version turn the trees into merkletrie.Noders and call the merkletrie.Difftree function on them.
How to review this PR:
treenoder.go: defines the treeNoder type that wraps a git.Tree and implements merkletrie.Noder.
change.go: defines the type of the output of a difftree operation. The type is the same as before, but I have moved it into its own file to keep the package organized. The old package defines the Action type too (insert, delete, modify), now, we reuse merkletrie.Action and it is no longer a field, but a method.
change_adaptor.go: defines functions to turn merkletrie.Changes into difftree.Changes.
difftree.go: before this patch this file holds all the logic to do a difftree, now it just turns the git.Trees into treeNoders, call merkletrie.difftree on them, and turns the resulting merkletrie.Changes into difftree.Changes.
The only interesting piece of code here is that noders don't have the concept of mode (file permissions). The treenoder type codifies git.Tree modes into the merkletrie.Noder hash, so changes in the mode of a file are detected as modifications, just as the original git diff-tree command does.
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions