Skip to content

Commit

Permalink
OPT: use set O(log(n)) instead of list O(n) for checking if modified …
Browse files Browse the repository at this point in the history
…in _check_files

Likely impact is minimal since likely is not used for heavy lists
of files, but who knows
  • Loading branch information
yarikoptic committed Sep 6, 2024
1 parent 19f5b45 commit 6620deb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions datalad/support/annexrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 set()
annex_res = fn(files, normalize_paths=False, batch=batch)
return [bool(annex_res.get(f) and
not (pointers and normpath(f) in modified))
Expand Down

0 comments on commit 6620deb

Please sign in to comment.