[PATCH 2/7] recursive_dirlist: remove redundant top-level path stat

0 views
Skip to first unread message

Rob Browning

unread,
Mar 15, 2026, 6:25:34 PM (9 days ago) Mar 15
to bup-...@googlegroups.com
We already have an lstat of the path, and from that we know it's a
directory, so relying on the st_dev is fine.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---
lib/bup/drecurse.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/bup/drecurse.py b/lib/bup/drecurse.py
index 7b639109..215c7132 100644
--- a/lib/bup/drecurse.py
+++ b/lib/bup/drecurse.py
@@ -96,11 +96,7 @@ def recursive_dirlist(paths, xdev, bup_dir=None,
add_error(e)
continue
with opened_pfile as pfile:
- pst = xstat.fstat(pfile)
- if xdev:
- xdev = pst.st_dev
- else:
- xdev = None
+ xdev = pst.st_dev if xdev else None
if stat.S_ISDIR(pst.st_mode):
os.fchdir(pfile)
prepend = os.path.join(path, b'')
--
2.47.3

Reply all
Reply to author
Forward
0 new messages