rewriter: simplified logic for empty subdirectories

This commit is contained in:
Winfried Plappert 2025-02-19 15:18:35 +00:00
parent f3e1bf437f
commit 04c9b35481
1 changed files with 5 additions and 8 deletions

View File

@ -161,14 +161,11 @@ func (t *TreeRewriter) RewriteTree(ctx context.Context, repo BlobLoadSaver, node
} }
countInserts++ countInserts++
} }
} else { // check for empty node list
countInserts = 1 if t.opts.KeepEmptyDirecoryGlobal && countInserts == 0 {
} // current subdirectory is empty - due to no includes: create condition here
return restic.ID{}, nil
// check for empty node list }
if t.opts.KeepEmptyDirecoryGlobal && countInserts == 0 {
// current subdirectory is empty - due to no includes: create condition here
return restic.ID{}, nil
} }
tree, err := tb.Finalize() tree, err := tb.Finalize()