summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r--lib/App/BorgRestore/PathTimeTable/DB.pm6
1 files changed, 4 insertions, 2 deletions
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) {