From b42d7f36f95c069946a82793f8fd8b8cda650127 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 12 Sep 2018 23:00:52 +0200 Subject: Only add top level directory when we actually have a top level directory Signed-off-by: Florian Pritz --- lib/App/BorgRestore/PathTimeTable/DB.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm index 3d080d1..3242b76 100644 --- a/lib/App/BorgRestore/PathTimeTable/DB.pm +++ b/lib/App/BorgRestore/PathTimeTable/DB.pm @@ -69,8 +69,10 @@ method add_path($path, $time) { $path = substr($path, 0, $slash_index); } - # ensure that top level directory is also written - $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $self->{cache}->{$old_cache_path}) unless $old_cache_path eq "."; + if ($old_cache_path ne substr($path, 0, length($old_cache_path))) { + # ensure that top level directory is also written + $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $self->{cache}->{$old_cache_path}) unless $old_cache_path eq "."; + } my $cached = $self->{cache}->{$path}; if (!defined $cached || $cached < $time) { -- cgit v1.2.3-24-g4f1b