pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pre-commit/pre-commit/commit/c05f58b776603dc2a5222f035c2dc058426497de

ef="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> add git version to error output · pre-commit/pre-commit@c05f58b · GitHub
Skip to content

Commit c05f58b

Browse files
committed
add git version to error output
1 parent 12b4823 commit c05f58b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

pre_commit/error_handler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pre_commit import output
1010
from pre_commit.errors import FatalError
1111
from pre_commit.store import Store
12+
from pre_commit.util import cmd_output_b
1213
from pre_commit.util import force_bytes
1314

1415

@@ -21,6 +22,9 @@ def _log_and_exit(
2122
error_msg = f'{msg}: {type(exc).__name__}: '.encode() + force_bytes(exc)
2223
output.write_line_b(error_msg)
2324

25+
_, git_version_b, _ = cmd_output_b('git', '--version', retcode=None)
26+
git_version = git_version_b.decode(errors='backslashreplace').rstrip()
27+
2428
storedir = Store().directory
2529
log_path = os.path.join(storedir, 'pre-commit.log')
2630
with contextlib.ExitStack() as ctx:
@@ -38,6 +42,7 @@ def _log_and_exit(
3842
_log_line()
3943
_log_line('```')
4044
_log_line(f'pre-commit version: {C.VERSION}')
45+
_log_line(f'git --version: {git_version}')
4146
_log_line('sys.version:')
4247
for line in sys.version.splitlines():
4348
_log_line(f' {line}')

tests/error_handler_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def test_log_and_exit(cap_out, mock_store_dir):
122122
r'\n'
123123
r'```\n'
124124
r'pre-commit version: \d+\.\d+\.\d+\n'
125+
r'git --version: git version .+\n'
125126
r'sys.version:\n'
126127
r'( .*\n)*'
127128
r'sys.executable: .*\n'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy