diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-24 09:44:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 09:44:53 +0100 |
commit | 294d6f4e6f1b60eb0f53515c1fb64b86db21d241 (patch) | |
tree | 96f136e2449f5dad9db06b769b63a5ad95aec8fa /plumbing/difftree/difftree_test.go | |
parent | b5da4e98571b02dc106de4f9b2cb2a298489f1b1 (diff) | |
parent | cf4e8699879a2f8b2efad64a3efbbebb9cac39ef (diff) | |
download | go-git-294d6f4e6f1b60eb0f53515c1fb64b86db21d241.tar.gz |
Merge pull request #285 from alcortesm/fix-issue-279
Fix issue 279
Diffstat (limited to 'plumbing/difftree/difftree_test.go')
-rw-r--r-- | plumbing/difftree/difftree_test.go | 24 |
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) +} |