diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-09-12 23:00:52 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-09-12 23:07:47 +0200 |
commit | b42d7f36f95c069946a82793f8fd8b8cda650127 (patch) | |
tree | 929366600c9a067e3162a12a42e0810e79883cb6 /lib/App/BorgRestore/PathTimeTable | |
parent | 048fba723dfc61ae55ae4a95c96c038f19fe1aed (diff) | |
download | App-BorgRestore-b42d7f36f95c069946a82793f8fd8b8cda650127.tar.gz App-BorgRestore-b42d7f36f95c069946a82793f8fd8b8cda650127.tar.xz |
Only add top level directory when we actually have a top level directory
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore/PathTimeTable')
-rw-r--r-- | lib/App/BorgRestore/PathTimeTable/DB.pm | 6 |
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) { |