diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-11-20 02:19:23 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-11-20 02:19:23 +0100 |
commit | c0e26a107c56b23127a633af6c4c52220f9a2207 (patch) | |
tree | 1379e173cf5e662b38a61017abf2931b40995740 /utils/merkletrie/filesystem/node_test.go | |
parent | de4769c8ee1fd80478deca1bd66b29b1f8c28526 (diff) | |
download | go-git-c0e26a107c56b23127a633af6c4c52220f9a2207.tar.gz |
utils: merkletrie, filesystem fix symlinks to dir
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'utils/merkletrie/filesystem/node_test.go')
-rw-r--r-- | utils/merkletrie/filesystem/node_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/utils/merkletrie/filesystem/node_test.go b/utils/merkletrie/filesystem/node_test.go index 42dd82e..7aa0d97 100644 --- a/utils/merkletrie/filesystem/node_test.go +++ b/utils/merkletrie/filesystem/node_test.go @@ -82,6 +82,42 @@ func (s *NoderSuite) TestDiffChangeContent(c *C) { c.Assert(ch, HasLen, 1) } +func (s *NoderSuite) TestDiffSymlinkDirOnA(c *C) { + fsA := memfs.New() + WriteFile(fsA, "qux/qux", []byte("foo"), 0644) + + fsB := memfs.New() + fsB.Symlink("qux", "foo") + WriteFile(fsB, "qux/qux", []byte("foo"), 0644) + + ch, err := merkletrie.DiffTree( + NewRootNode(fsA, nil), + NewRootNode(fsB, nil), + IsEquals, + ) + + c.Assert(err, IsNil) + c.Assert(ch, HasLen, 1) +} + +func (s *NoderSuite) TestDiffSymlinkDirOnB(c *C) { + fsA := memfs.New() + fsA.Symlink("qux", "foo") + WriteFile(fsA, "qux/qux", []byte("foo"), 0644) + + fsB := memfs.New() + WriteFile(fsB, "qux/qux", []byte("foo"), 0644) + + ch, err := merkletrie.DiffTree( + NewRootNode(fsA, nil), + NewRootNode(fsB, nil), + IsEquals, + ) + + c.Assert(err, IsNil) + c.Assert(ch, HasLen, 1) +} + func (s *NoderSuite) TestDiffChangeMissing(c *C) { fsA := memfs.New() WriteFile(fsA, "foo", []byte("foo"), 0644) |