@@ -2,7 +2,7 @@ package index
2
2
3
3
import (
4
4
"bytes"
5
- "path/filepath "
5
+ "path"
6
6
"testing"
7
7
8
8
"github.com/go-git/go-git/v5/plumbing"
@@ -46,14 +46,14 @@ func (s *NoderSuite) TestDiff(c *C) {
46
46
func (s * NoderSuite ) TestDiffChange (c * C ) {
47
47
indexA := & index.Index {
48
48
Entries : []* index.Entry {{
49
- Name : filepath .Join ("bar" , "baz" , "bar" ),
49
+ Name : path .Join ("bar" , "baz" , "bar" ),
50
50
Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
51
51
}},
52
52
}
53
53
54
54
indexB := & index.Index {
55
55
Entries : []* index.Entry {{
56
- Name : filepath .Join ("bar" , "baz" , "foo" ),
56
+ Name : path .Join ("bar" , "baz" , "foo" ),
57
57
Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
58
58
}},
59
59
}
@@ -63,6 +63,32 @@ func (s *NoderSuite) TestDiffChange(c *C) {
63
63
c .Assert (ch , HasLen , 2 )
64
64
}
65
65
66
+ func (s * NoderSuite ) TestDiffSkipIssue1455 (c * C ) {
67
+ indexA := & index.Index {
68
+ Entries : []* index.Entry {
69
+ {
70
+ Name : path .Join ("bar" , "baz" , "bar" ),
71
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
72
+ SkipWorktree : true ,
73
+ },
74
+ {
75
+ Name : path .Join ("bar" , "biz" , "bat" ),
76
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
77
+ SkipWorktree : false ,
78
+ },
79
+ },
80
+ }
81
+
82
+ indexB := & index.Index {}
83
+
84
+ ch , err := merkletrie .DiffTree (NewRootNode (indexB ), NewRootNode (indexA ), isEquals )
85
+ c .Assert (err , IsNil )
86
+ c .Assert (ch , HasLen , 1 )
87
+ a , err := ch [0 ].Action ()
88
+ c .Assert (err , IsNil )
89
+ c .Assert (a , Equals , merkletrie .Insert )
90
+ }
91
+
66
92
func (s * NoderSuite ) TestDiffDir (c * C ) {
67
93
indexA := & index.Index {
68
94
Entries : []* index.Entry {{
@@ -73,7 +99,7 @@ func (s *NoderSuite) TestDiffDir(c *C) {
73
99
74
100
indexB := & index.Index {
75
101
Entries : []* index.Entry {{
76
- Name : filepath .Join ("foo" , "bar" ),
102
+ Name : path .Join ("foo" , "bar" ),
77
103
Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
78
104
}},
79
105
}
0 commit comments