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 regression when using git worktree #777

Closed
skyj opened this issue Jun 6, 2022 · 2 comments · Fixed by #778
Closed

check-added-large-files regression when using git worktree #777

skyj opened this issue Jun 6, 2022 · 2 comments · Fixed by #778
Labels

Comments

@skyj
Copy link

skyj commented Jun 6, 2022

Hello,

After upgrading from v3.4.0 to v4.2.0, the check-added-large-files hook is now failing when used inside a worktree:

check for added large files............................................................Failed
- hook id: check-added-large-files
- exit code: 1

fatal: '/home/.../main-repo/.git/worktrees/worktree-repo/COMMIT_EDITMSG' is outside repository at '/home/.../worktree-repo'
Traceback (most recent call last):
  File "/home/.../.cache/pre-commit/repo_kdm5un1/py_env-python3.10/bin/check-added-large-files", line 8, in <module>
    sys.exit(main())
  File "/home/.../.cache/pre-commit/repo_kdm5un1/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_added_large_files.py", line 73, in main
    return find_large_added_files(
  File "/home/.../.cache/pre-commit/repo_kdm5un1/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_added_large_files.py", line 43, in find_large_added_files
    filter_lfs_files(filenames_filtered)
  File "/home/.../.cache/pre-commit/repo_kdm5un1/py_env-python3.10/lib/python3.10/site-packages/pre_commit_hooks/check_added_large_files.py", line 18, in filter_lfs_files
    check_attr = subprocess.run(
  File "/home/.../.asdf/installs/python/3.10.4/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('git', 'check-attr', 'filter', '-z', '--stdin')' returned non-zero exit status 128.

I believe the regression comes from 03a65ca

@asottile
Copy link
Member

asottile commented Jun 6, 2022

can you try the patch in #778 -- you can use rev to select that commit and see if it works!

@asottile asottile added the bug label Jun 6, 2022
@skyj
Copy link
Author

skyj commented Jun 7, 2022

Works fine, thank you 🙏

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

Successfully merging a pull request may close this issue.

2 participants