Skip to content

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

@skyj

Description

@skyj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions