mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
timestamps: minor code refactor, nothing else to do, #6908
https://github.com/borgbackup/borg/issues/6908#issuecomment-1224886207
This commit is contained in:
parent
3280603e43
commit
6e2419f3b2
1 changed files with 3 additions and 6 deletions
|
@ -920,11 +920,7 @@ def restore_attrs(self, path, item, symlink=False, fd=None):
|
|||
if not symlink:
|
||||
os.chmod(path, item.mode)
|
||||
mtime = item.mtime
|
||||
if "atime" in item:
|
||||
atime = item.atime
|
||||
else:
|
||||
# old archives only had mtime in item metadata
|
||||
atime = mtime
|
||||
atime = item.atime if "atime" in item else mtime
|
||||
if "birthtime" in item:
|
||||
birthtime = item.birthtime
|
||||
try:
|
||||
|
@ -1119,10 +1115,11 @@ def __init__(self, *, noatime, noctime, nobirthtime, numeric_ids, noflags, noacl
|
|||
self.nobirthtime = nobirthtime
|
||||
|
||||
def stat_simple_attrs(self, st):
|
||||
attrs = dict(mode=st.st_mode, uid=st.st_uid, gid=st.st_gid, mtime=safe_ns(st.st_mtime_ns))
|
||||
attrs = dict(mode=st.st_mode, uid=st.st_uid, gid=st.st_gid)
|
||||
# borg can work with archives only having mtime (very old borg archives do not have
|
||||
# atime/ctime). it can be useful to omit atime/ctime, if they change without the
|
||||
# file content changing - e.g. to get better metadata deduplication.
|
||||
attrs["mtime"] = safe_ns(st.st_mtime_ns)
|
||||
if not self.noatime:
|
||||
attrs["atime"] = safe_ns(st.st_atime_ns)
|
||||
if not self.noctime:
|
||||
|
|
Loading…
Reference in a new issue