aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/difftree/difftree_test.go
diff options
context:
space:
mode:
authorAlberto Cortés <alberto@sourced.tech>2017-02-22 15:11:30 +0100
committerAlberto Cortés <alberto@sourced.tech>2017-02-22 17:37:28 +0100
commitd27c741e3b68357e46cc0a85a33a184fecc05c29 (patch)
tree4a95f2a9ac14378e428ea2fa51010e77e8f2a2f7 /plumbing/difftree/difftree_test.go
parentb5da4e98571b02dc106de4f9b2cb2a298489f1b1 (diff)
downloadgo-git-d27c741e3b68357e46cc0a85a33a184fecc05c29.tar.gz
test for issue 279
Diffstat (limited to 'plumbing/difftree/difftree_test.go')
-rw-r--r--plumbing/difftree/difftree_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/plumbing/difftree/difftree_test.go b/plumbing/difftree/difftree_test.go
index e2519b3..24817f1 100644
--- a/plumbing/difftree/difftree_test.go
+++ b/plumbing/difftree/difftree_test.go
@@ -1,6 +1,7 @@
package difftree
import (
+ "os"
"sort"
"testing"
@@ -353,3 +354,26 @@ func (s *DiffTreeSuite) TestDiffTree(c *C) {
assertChanges(obtained, 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"),
+ mode: os.FileMode(0100664),
+ }
+ to := &treeNoder{
+ hash: plumbing.NewHash("d08e895238bac36d8220586fdc28c27e1a7a76d3"),
+ mode: os.FileMode(0100644),
+ }
+ c.Assert(hashEqual(from, to), Equals, true)
+ c.Assert(hashEqual(to, from), Equals, true)
+
+ // but should detect if the contents of the file also changed.
+ to = &treeNoder{
+ hash: plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
+ mode: os.FileMode(0100644),
+ }
+ c.Assert(hashEqual(from, to), Equals, false)
+ c.Assert(hashEqual(to, from), Equals, false)
+}