File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ type TreeManifest struct {
450
450
451
451
func (workTree * WorkTree ) GetTreeManifest (ctx context.Context , pattern string ) (TreeManifest , error ) {
452
452
//todo match all files, it maybe slow maybe need a new algo like filepath.Glob
453
+ pattern = strings .ReplaceAll (pattern , "\\ " , "/" )
453
454
wk := FileWalk {curNode : workTree .root , object : workTree .object }
454
455
g , err := glob .Compile (pattern )
455
456
if err != nil {
Original file line number Diff line number Diff line change @@ -189,6 +189,13 @@ func TestWorkTreeGetFiles(t *testing.T) {
189
189
require .Equal (t , "ff/b/f.jpg" , manifest .FileList [6 ])
190
190
})
191
191
192
+ t .Run ("replace windows style separate char" , func (t * testing.T ) {
193
+ manifest , err := workTree .GetTreeManifest (ctx , "a\\ b\\ d.txt" )
194
+ require .NoError (t , err )
195
+ require .Equal (t , 1 , len (manifest .FileList ))
196
+ require .Equal (t , "a/b/d.txt" , manifest .FileList [0 ])
197
+ })
198
+
192
199
t .Run ("single file" , func (t * testing.T ) {
193
200
manifest , err := workTree .GetTreeManifest (ctx , "a/b/d.txt" )
194
201
require .NoError (t , err )
You can’t perform that action at this time.
0 commit comments