mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 12:06:53 +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
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
from pre_commit_hooks.no_commit_to_branch import is_on_branch
|
||||
from pre_commit_hooks.no_commit_to_branch import main
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
from testing.util import git_commit
|
||||
|
||||
|
||||
def test_other_branch(temp_git_dir):
|
||||
|
|
@ -62,7 +63,7 @@ def test_main_default_call(temp_git_dir):
|
|||
|
||||
def test_not_on_a_branch(temp_git_dir):
|
||||
with temp_git_dir.as_cwd():
|
||||
cmd_output('git', 'commit', '--no-gpg-sign', '--allow-empty', '-m1')
|
||||
git_commit('--allow-empty', '-m1')
|
||||
head = cmd_output('git', 'rev-parse', 'HEAD').strip()
|
||||
cmd_output('git', 'checkout', head)
|
||||
# we're not on a branch!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue