Browse Source

recreate: cachedir_masters not needed any more

now all hardlinked regular file items have chunks.
Thomas Waldmann 3 years ago
parent
commit
e5f1a4fb4d
1 changed files with 1 additions and 18 deletions
  1. 1 18
      src/borg/archive.py

+ 1 - 18
src/borg/archive.py

@@ -2199,30 +2199,13 @@ class ArchiveRecreater:
         tag_files = []
         tag_files = []
         tagged_dirs = []
         tagged_dirs = []
 
 
-        # to support reading hard-linked CACHEDIR.TAGs (aka CACHE_TAG_NAME):
-        cachedir_masters = {}
-
-        if self.exclude_caches:
-            # sadly, due to how CACHEDIR.TAG works (filename AND file [header] contents) and
-            # how borg deals with hardlinks (slave hardlinks referring back to master hardlinks),
-            # we need to pass over the archive collecting hardlink master paths.
-            # as seen in issue #4911, the master paths can have an arbitrary filenames,
-            # not just CACHEDIR.TAG.
-            for item in archive.iter_items(filter=lambda item: os.path.basename(item.path) == CACHE_TAG_NAME):
-                if stat.S_ISREG(item.mode) and 'chunks' not in item and 'source' in item:
-                    # this is a hardlink slave, referring back to its hardlink master (via item.source)
-                    cachedir_masters[item.source] = None  # we know the key (path), but not the value (item) yet
-
         for item in archive.iter_items(
         for item in archive.iter_items(
                 filter=lambda item: os.path.basename(item.path) == CACHE_TAG_NAME or matcher.match(item.path)):
                 filter=lambda item: os.path.basename(item.path) == CACHE_TAG_NAME or matcher.match(item.path)):
-            if self.exclude_caches and item.path in cachedir_masters:
-                cachedir_masters[item.path] = item
             dir, tag_file = os.path.split(item.path)
             dir, tag_file = os.path.split(item.path)
             if tag_file in self.exclude_if_present:
             if tag_file in self.exclude_if_present:
                 exclude(dir, item)
                 exclude(dir, item)
             elif self.exclude_caches and tag_file == CACHE_TAG_NAME and stat.S_ISREG(item.mode):
             elif self.exclude_caches and tag_file == CACHE_TAG_NAME and stat.S_ISREG(item.mode):
-                content_item = item if 'chunks' in item else cachedir_masters[item.source]
-                file = open_item(archive, content_item)
+                file = open_item(archive, item)
                 if file.read(len(CACHE_TAG_CONTENTS)) == CACHE_TAG_CONTENTS:
                 if file.read(len(CACHE_TAG_CONTENTS)) == CACHE_TAG_CONTENTS:
                     exclude(dir, item)
                     exclude(dir, item)
         matcher.add(tag_files, IECommand.Include)
         matcher.add(tag_files, IECommand.Include)