mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-24 08:45:13 +00:00
Merge pull request #1413 from ThomasWaldmann/store-mountpoint-dirs
save mountpoint dirs, fixes #1033
This commit is contained in:
commit
b7a563885d
1 changed files with 26 additions and 23 deletions
|
@ -324,9 +324,10 @@ def _process(self, archive, cache, matcher, exclude_caches, exclude_if_present,
|
|||
return
|
||||
if (st.st_ino, st.st_dev) in skip_inodes:
|
||||
return
|
||||
# Entering a new filesystem?
|
||||
if restrict_dev is not None and st.st_dev != restrict_dev:
|
||||
return
|
||||
# if restrict_dev is given, we do not want to recurse into a new filesystem,
|
||||
# but we WILL save the mountpoint directory (or more precise: the root
|
||||
# directory of the mounted filesystem that shadows the mountpoint dir).
|
||||
recurse = restrict_dev is None or st.st_dev == restrict_dev
|
||||
status = None
|
||||
# Ignore if nodump flag is set
|
||||
try:
|
||||
|
@ -344,28 +345,30 @@ def _process(self, archive, cache, matcher, exclude_caches, exclude_if_present,
|
|||
status = 'E'
|
||||
self.print_warning('%s: %s', path, e)
|
||||
elif stat.S_ISDIR(st.st_mode):
|
||||
tag_paths = dir_is_tagged(path, exclude_caches, exclude_if_present)
|
||||
if tag_paths:
|
||||
if keep_tag_files and not dry_run:
|
||||
archive.process_dir(path, st)
|
||||
for tag_path in tag_paths:
|
||||
self._process(archive, cache, matcher, exclude_caches, exclude_if_present,
|
||||
keep_tag_files, skip_inodes, tag_path, restrict_dev,
|
||||
read_special=read_special, dry_run=dry_run)
|
||||
return
|
||||
if recurse:
|
||||
tag_paths = dir_is_tagged(path, exclude_caches, exclude_if_present)
|
||||
if tag_paths:
|
||||
if keep_tag_files and not dry_run:
|
||||
archive.process_dir(path, st)
|
||||
for tag_path in tag_paths:
|
||||
self._process(archive, cache, matcher, exclude_caches, exclude_if_present,
|
||||
keep_tag_files, skip_inodes, tag_path, restrict_dev,
|
||||
read_special=read_special, dry_run=dry_run)
|
||||
return
|
||||
if not dry_run:
|
||||
status = archive.process_dir(path, st)
|
||||
try:
|
||||
entries = helpers.scandir_inorder(path)
|
||||
except OSError as e:
|
||||
status = 'E'
|
||||
self.print_warning('%s: %s', path, e)
|
||||
else:
|
||||
for dirent in entries:
|
||||
normpath = os.path.normpath(dirent.path)
|
||||
self._process(archive, cache, matcher, exclude_caches, exclude_if_present,
|
||||
keep_tag_files, skip_inodes, normpath, restrict_dev,
|
||||
read_special=read_special, dry_run=dry_run)
|
||||
if recurse:
|
||||
try:
|
||||
entries = helpers.scandir_inorder(path)
|
||||
except OSError as e:
|
||||
status = 'E'
|
||||
self.print_warning('%s: %s', path, e)
|
||||
else:
|
||||
for dirent in entries:
|
||||
normpath = os.path.normpath(dirent.path)
|
||||
self._process(archive, cache, matcher, exclude_caches, exclude_if_present,
|
||||
keep_tag_files, skip_inodes, normpath, restrict_dev,
|
||||
read_special=read_special, dry_run=dry_run)
|
||||
elif stat.S_ISLNK(st.st_mode):
|
||||
if not dry_run:
|
||||
if not read_special:
|
||||
|
|
Loading…
Reference in a new issue