From 04c9b354811b20e53cb1fb83ba131e8002429565 Mon Sep 17 00:00:00 2001 From: Winfried Plappert Date: Wed, 19 Feb 2025 15:18:35 +0000 Subject: [PATCH] rewriter: simplified logic for empty subdirectories --- internal/walker/rewriter.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/walker/rewriter.go b/internal/walker/rewriter.go index 9e380733a..91a5c9190 100644 --- a/internal/walker/rewriter.go +++ b/internal/walker/rewriter.go @@ -161,14 +161,11 @@ func (t *TreeRewriter) RewriteTree(ctx context.Context, repo BlobLoadSaver, node } countInserts++ } - } else { - countInserts = 1 - } - - // 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 + // 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()