aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/difftree_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object/difftree_test.go')
-rw-r--r--plumbing/object/difftree_test.go31
1 files changed, 17 insertions, 14 deletions
diff --git a/plumbing/object/difftree_test.go b/plumbing/object/difftree_test.go
index fa996c2..11f6b23 100644
--- a/plumbing/object/difftree_test.go
+++ b/plumbing/object/difftree_test.go
@@ -358,24 +358,27 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) {
}
func (s *DiffTreeSuite) TestIssue279(c *C) {
- // HashEqual should ignore files if the only change is from a 100664
- // mode to a 100644 or vice versa.
- from := &treeNoder{
- hash: plumbing.NewHash("d08e895238bac36d8220586fdc28c27e1a7a76d3"),
+ // treeNoders should have the same hash when their mode is
+ // filemode.Deprecated and filemode.Regular.
+ a := &treeNoder{
+ hash: plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
mode: filemode.Regular,
}
- to := &treeNoder{
- hash: plumbing.NewHash("d08e895238bac36d8220586fdc28c27e1a7a76d3"),
- mode: filemode.Regular,
+ b := &treeNoder{
+ hash: plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
+ mode: filemode.Deprecated,
}
- c.Assert(hashEqual(from, to), Equals, true)
- c.Assert(hashEqual(to, from), Equals, true)
+ c.Assert(a.Hash(), DeepEquals, b.Hash())
- // but should detect if the contents of the file also changed.
- to = &treeNoder{
- hash: plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
+ // yet, they should have different hashes if their contents change.
+ aa := &treeNoder{
+ hash: plumbing.NewHash("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"),
mode: filemode.Regular,
}
- c.Assert(hashEqual(from, to), Equals, false)
- c.Assert(hashEqual(to, from), Equals, false)
+ c.Assert(a.Hash(), Not(DeepEquals), aa.Hash())
+ bb := &treeNoder{
+ hash: plumbing.NewHash("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"),
+ mode: filemode.Deprecated,
+ }
+ c.Assert(b.Hash(), Not(DeepEquals), bb.Hash())
}