From 05aac4929afc92844890022b54ae87ee21b70536 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 6 Sep 2024 11:11:26 -0400 Subject: [PATCH] OPT: use set O(log(n)) instead of list O(n) for checking if modified in _check_files Likely impact is minimal since likely is not used for heavy lists of files, but who knows --- datalad/support/annexrepo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datalad/support/annexrepo.py b/datalad/support/annexrepo.py index dd51b6344b..8baca83531 100644 --- a/datalad/support/annexrepo.py +++ b/datalad/support/annexrepo.py @@ -1997,10 +1997,11 @@ def _check_files(self, fn, files, batch): # ATTN: test_AnnexRepo_file_has_content has a failure before Git # v2.13 (tested back to v2.9) because this diff call unexpectedly # reports a type change as modified. - modified = [ + modified = { f for f in self.call_git_items_( ['diff', '--name-only', '-z'], sep='\0') - if f] if pointers else [] + if f + } if pointers else [] annex_res = fn(files, normalize_paths=False, batch=batch) return [bool(annex_res.get(f) and not (pointers and normpath(f) in modified))