mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 12:34:17 +00:00
forbid-new-submodules: fix triggering failure when only a submodule is committed (without any other file); support --from-ref and --to-ref; fixes #609
This commit is contained in:
parent
8c1183c0c8
commit
10c5e4e166
9 changed files with 65 additions and 25 deletions
|
|
@ -5,6 +5,7 @@ import pytest
|
|||
from pre_commit_hooks.check_added_large_files import find_large_added_files
|
||||
from pre_commit_hooks.check_added_large_files import main
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
from testing.util import git_commit
|
||||
|
||||
|
||||
def test_nothing_added(temp_git_dir):
|
||||
|
|
@ -104,7 +105,7 @@ def test_moves_with_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
|
|||
# First add the file we're going to move
|
||||
temp_git_dir.join('a.bin').write('a' * 10000)
|
||||
cmd_output('git', 'add', '--', '.')
|
||||
cmd_output('git', 'commit', '--no-gpg-sign', '-am', 'foo')
|
||||
git_commit('-am', 'foo')
|
||||
# Now move it and make sure the hook still succeeds
|
||||
cmd_output('git', 'mv', 'a.bin', 'b.bin')
|
||||
assert main(('--maxkb', '9', 'b.bin')) == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue