mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Fix check-added-large-files --enforce-all to correctly consider all git-lfs files.
`git lfs status` only outputs status for files that are pending some git-lfs related operation. For usage with --enforce-all, we need the list of all files that are tracked, which can be achived by `git lfs ls-files`. Fixes: https://github.com/pre-commit/pre-commit-hooks/issues/560
This commit is contained in:
parent
b8d76787ff
commit
03a65ca357
2 changed files with 35 additions and 11 deletions
|
|
@ -121,3 +121,16 @@ def test_enforce_allows_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
|
|||
cmd_output('git', 'add', '--', '.')
|
||||
# With --enforce-all large files on git lfs should succeed
|
||||
assert main(('--enforce-all', '--maxkb', '9', 'f.py')) == 0
|
||||
|
||||
|
||||
@xfailif_no_gitlfs # pragma: no cover
|
||||
def test_enforce_allows_gitlfs_after_commit(temp_git_dir, monkeypatch):
|
||||
with temp_git_dir.as_cwd():
|
||||
monkeypatch.setenv('HOME', str(temp_git_dir))
|
||||
cmd_output('git', 'lfs', 'install')
|
||||
temp_git_dir.join('f.py').write('a' * 10000)
|
||||
cmd_output('git', 'lfs', 'track', 'f.py')
|
||||
cmd_output('git', 'add', '--', '.')
|
||||
git_commit('-am', 'foo')
|
||||
# With --enforce-all large files on git lfs should succeed
|
||||
assert main(('--enforce-all', '--maxkb', '9', 'f.py')) == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue