mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-27 05:35:28 -04:00
precommit: Ignore very large files
This commit is contained in:
parent
0d7f5ab581
commit
2819de3bd6
1 changed files with 2 additions and 1 deletions
|
|
@ -124,11 +124,12 @@ def main() -> None:
|
|||
continue
|
||||
file_list += [os.path.join(root, fn) for fn in files]
|
||||
|
||||
# Filter symlinks, backup copies, logs, and hidden files.
|
||||
# Filter symlinks, backup copies, logs, hidden, and very large files.
|
||||
file_list = [fn for fn in file_list if not os.path.islink(fn)]
|
||||
file_list = [fn for fn in file_list if not fn[-1] in ("~", "#")]
|
||||
file_list = [fn for fn in file_list if not fn.endswith(".log")]
|
||||
file_list = [fn for fn in file_list if not os.path.basename(fn).startswith(".")]
|
||||
file_list = [fn for fn in file_list if os.path.getsize(fn) < 2**20] # 1MiB
|
||||
|
||||
# Sort files by size as larger ones will take longer to process.
|
||||
file_list.sort(reverse=True, key=lambda fn: os.path.getsize(fn))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue