Adding upstream version 3.0.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2ba952a000
commit
4066ef5157
4 changed files with 53 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
3.0.4 - 2023-02-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix hook diff detection for files affected by `--textconv`.
|
||||||
|
- #2743 PR by @adamchainz.
|
||||||
|
- #2743 issue by @adamchainz.
|
||||||
|
|
||||||
3.0.3 - 2023-02-01
|
3.0.3 - 2023-02-01
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,8 @@ def _all_filenames(args: argparse.Namespace) -> Collection[str]:
|
||||||
|
|
||||||
def _get_diff() -> bytes:
|
def _get_diff() -> bytes:
|
||||||
_, out, _ = cmd_output_b(
|
_, out, _ = cmd_output_b(
|
||||||
'git', 'diff', '--no-ext-diff', '--ignore-submodules', check=False,
|
'git', 'diff', '--no-ext-diff', '--no-textconv', '--ignore-submodules',
|
||||||
|
check=False,
|
||||||
)
|
)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
@ -326,8 +327,7 @@ def _has_unmerged_paths() -> bool:
|
||||||
|
|
||||||
def _has_unstaged_config(config_file: str) -> bool:
|
def _has_unstaged_config(config_file: str) -> bool:
|
||||||
retcode, _, _ = cmd_output_b(
|
retcode, _, _ = cmd_output_b(
|
||||||
'git', 'diff', '--no-ext-diff', '--exit-code', config_file,
|
'git', 'diff', '--quiet', '--no-ext-diff', config_file, check=False,
|
||||||
check=False,
|
|
||||||
)
|
)
|
||||||
# be explicit, other git errors don't mean it has an unstaged config.
|
# be explicit, other git errors don't mean it has an unstaged config.
|
||||||
return retcode == 1
|
return retcode == 1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = pre_commit
|
name = pre_commit
|
||||||
version = 3.0.3
|
version = 3.0.4
|
||||||
description = A framework for managing and maintaining multi-language pre-commit hooks.
|
description = A framework for managing and maintaining multi-language pre-commit hooks.
|
||||||
long_description = file: README.md
|
long_description = file: README.md
|
||||||
long_description_content_type = text/markdown
|
long_description_content_type = text/markdown
|
||||||
|
|
|
@ -766,6 +766,47 @@ def test_lots_of_files(store, tempdir_factory):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_textconv(cap_out, store, repo_with_passing_hook):
|
||||||
|
# git textconv filters can hide changes from hooks
|
||||||
|
with open('.gitattributes', 'w') as fp:
|
||||||
|
fp.write('*.jpeg diff=empty\n')
|
||||||
|
|
||||||
|
with open('.git/config', 'a') as fp:
|
||||||
|
fp.write('[diff "empty"]\n')
|
||||||
|
fp.write('textconv = "true"\n')
|
||||||
|
|
||||||
|
config = {
|
||||||
|
'repo': 'local',
|
||||||
|
'hooks': [
|
||||||
|
{
|
||||||
|
'id': 'extend-jpeg',
|
||||||
|
'name': 'extend-jpeg',
|
||||||
|
'language': 'system',
|
||||||
|
'entry': (
|
||||||
|
f'{shlex.quote(sys.executable)} -c "import sys; '
|
||||||
|
'open(sys.argv[1], \'ab\').write(b\'\\x00\')"'
|
||||||
|
),
|
||||||
|
'types': ['jpeg'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
add_config_to_repo(repo_with_passing_hook, config)
|
||||||
|
|
||||||
|
stage_a_file('example.jpeg')
|
||||||
|
|
||||||
|
_test_run(
|
||||||
|
cap_out,
|
||||||
|
store,
|
||||||
|
repo_with_passing_hook,
|
||||||
|
{},
|
||||||
|
(
|
||||||
|
b'Failed',
|
||||||
|
),
|
||||||
|
expected_ret=1,
|
||||||
|
stage=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_stages(cap_out, store, repo_with_passing_hook):
|
def test_stages(cap_out, store, repo_with_passing_hook):
|
||||||
config = {
|
config = {
|
||||||
'repo': 'local',
|
'repo': 'local',
|
||||||
|
|
Loading…
Add table
Reference in a new issue