diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 21:16:23 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 21:16:23 +0200 |
commit | 1fd0a4963b4a5002b23bf4faa7814adca73818d6 (patch) | |
tree | 628051b686f71898965c0febd3e13097b2f64362 /utils/merkletrie/filesystem/node_test.go | |
parent | 5d1c674ea818ea534476ed0ca5436e0b513f86a4 (diff) | |
download | go-git-1fd0a4963b4a5002b23bf4faa7814adca73818d6.tar.gz |
utils: merkletrie support for symlinks
Diffstat (limited to 'utils/merkletrie/filesystem/node_test.go')
-rw-r--r-- | utils/merkletrie/filesystem/node_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/merkletrie/filesystem/node_test.go b/utils/merkletrie/filesystem/node_test.go index a383716..bf1178a 100644 --- a/utils/merkletrie/filesystem/node_test.go +++ b/utils/merkletrie/filesystem/node_test.go @@ -25,11 +25,13 @@ func (s *NoderSuite) TestDiff(c *C) { WriteFile(fsA, "foo", []byte("foo"), 0644) WriteFile(fsA, "qux/bar", []byte("foo"), 0644) WriteFile(fsA, "qux/qux", []byte("foo"), 0644) + fsA.Symlink("foo", "bar") fsB := memfs.New() WriteFile(fsB, "foo", []byte("foo"), 0644) WriteFile(fsB, "qux/bar", []byte("foo"), 0644) WriteFile(fsB, "qux/qux", []byte("foo"), 0644) + fsB.Symlink("foo", "bar") ch, err := merkletrie.DiffTree( NewRootNode(fsA, nil), @@ -41,6 +43,23 @@ func (s *NoderSuite) TestDiff(c *C) { c.Assert(ch, HasLen, 0) } +func (s *NoderSuite) TestDiffChangeLink(c *C) { + fsA := memfs.New() + fsA.Symlink("qux", "foo") + + fsB := memfs.New() + fsB.Symlink("bar", "foo") + + ch, err := merkletrie.DiffTree( + NewRootNode(fsA, nil), + NewRootNode(fsB, nil), + IsEquals, + ) + + c.Assert(err, IsNil) + c.Assert(ch, HasLen, 1) +} + func (s *NoderSuite) TestDiffChangeContent(c *C) { fsA := memfs.New() WriteFile(fsA, "foo", []byte("foo"), 0644) |