@@ -336,7 +336,7 @@ func (m *filesystemMerging) WithEachMerged(ctx context.Context, f func(context.C
336
336
)
337
337
338
338
// Build a mapping of BatchHeader + EntryDetail from dir
339
- mappings , err := m .buildDirMapping (dir )
339
+ mappings , err := m .buildDirMapping (dir , canceledFiles )
340
340
if err != nil {
341
341
el .Add (err )
342
342
}
@@ -395,9 +395,11 @@ func fileAcceptor(canceledFiles []string) func(string) ach.FileAcceptance {
395
395
}
396
396
}
397
397
398
- func (m * filesystemMerging ) buildDirMapping (dir string ) (* treemap.TreeMap [string , string ], error ) {
398
+ func (m * filesystemMerging ) buildDirMapping (dir string , canceledFiles [] string ) (* treemap.TreeMap [string , string ], error ) {
399
399
tree := treemap .New [string , string ]()
400
400
401
+ acceptor := fileAcceptor (canceledFiles )
402
+
401
403
err := fs .WalkDir (m .storage , dir , func (path string , d fs.DirEntry , err error ) error {
402
404
if err != nil {
403
405
if strings .Contains (err .Error (), "is a directory" ) {
@@ -415,6 +417,11 @@ func (m *filesystemMerging) buildDirMapping(dir string) (*treemap.TreeMap[string
415
417
return nil
416
418
}
417
419
420
+ // Skip the file if merging would have skipped it
421
+ if acceptor (path ) == ach .SkipFile {
422
+ return nil
423
+ }
424
+
418
425
fd , err := m .storage .Open (path )
419
426
if err != nil {
420
427
return fmt .Errorf ("opening %s failed: %w" , path , err )
0 commit comments