aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/difftree/change_adaptor_test.go
Commit message (Collapse)AuthorAgeFilesLines
* plumbing/object: move difftree to object packageAntonio Jesus Navarro Perez2017-02-241-413/+0
| | | | | - To avoid ciclic dependency errors, we move all the difftree files to object package. - Added Diff method to Tree object.
* difftree for git.Trees (#273)Alberto Cortés2017-02-211-0/+413
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.