Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-added-large-files IndexError in filter_lfs_files #810

Closed
fdcavalcanti opened this issue Sep 29, 2022 · 6 comments
Closed

check-added-large-files IndexError in filter_lfs_files #810

fdcavalcanti opened this issue Sep 29, 2022 · 6 comments

Comments

@fdcavalcanti
Copy link

Running the check-added-large-files is throwing the following error:
IndexError: list index out of range

More details:
Traceback (most recent call last):
  File "/home/fdcavalcanti/.cache/pre-commit/repouawq6m2z/py_env-python3/bin/check-added-large-files", line 8, in <module>
    sys.exit(main())
  File "/home/fdcavalcanti/.cache/pre-commit/repouawq6m2z/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_added_large_files.py", line 75, in main
    return find_large_added_files(
  File "/home/fdcavalcanti/.cache/pre-commit/repouawq6m2z/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_added_large_files.py", line 45, in find_large_added_files
    filter_lfs_files(filenames_filtered)
  File "/home/fdcavalcanti/.cache/pre-commit/repouawq6m2z/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_added_large_files.py", line 30, in filter_lfs_files
    filename, filter_tag = stdout[i], stdout[i + 2]
IndexError: list index out of range

Here's the data on stdout that is returned from the zsplit command. I replaced some names with 'nonononotests'.
['nonononotests/tool/tests/temperature/test_temp_board.py: filter: unspecified\nnonononotests/tool2/support/files/logo/nonononotests.bin: filter: unspecified\ndocs/source/nonononotests.production.rst: filter: unspecified\nnonononotests/tool2/tests/dac/test_dac_scan.py: filter: unspecified\n']

CentOS 7
Linux -- 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Python 3.8.12

@asottile
Copy link
Member

your version of git is 10 years old

@mikecuoco
Copy link

I'm having this same issue with pre-commit-hooks v4.5 and git 2.42.0

@asottile
Copy link
Member

that is unlikely. the error above is specifically due to very very old git output

@mikecuoco
Copy link

mikecuoco commented Oct 24, 2023

I have an old version of git on the HPC I work on, which I used to initialize this repo. But I just installed 2.42.0 in my conda environment and retried the commit. Is there something else I should do to have pre-commit recognize the new version of git?

@asottile
Copy link
Member

whatever is first on the PATH will get used. nothing special

@mikecuoco
Copy link

yup, sorry. It was still using the older version, which git was giving an inaccurate result. Sorry again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants