You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python version: Unknown (self-contained Windows release)
Describe the bug
It appears that this chain of if-else-statements is missing the case where the status is U, meaning that the file is unmerged. This leads to a crash of ggshield when running the pre-commit scan when such a file is present. A file can reach this state during an interactive git merge. I don't believe this situation will occur during a typical pre-commit hook invocation, but it can occur during manual ggshield calls as shown below.
Error: Can't parse header line :100644 000000 296458e 0000000 Utest file.txt: unknown status U
Traceback (most recent call last):
File "ggshield\cmd\utils\common_decorators.py", line 18, in wrapper
File "ggshield\cmd\secret\scan\precommit.py", line 83, in precommit_cmd
File "ggshield\core\scan\commit.py", line 108, in from_merge
File "ggshield\core\scan\commit_information.py", line 71, in from_staged
File "ggshield\core\scan\commit_information.py", line 45, in from_patch_header
File "ggshield\core\scan\commit_utils.py", line 195, in from_string
File "ggshield\core\scan\commit_utils.py", line 195, in <listcomp>
File "ggshield\core\scan\commit_utils.py", line 171, in from_string
ValueError: Can't parse header line :100644 000000 296458e 0000000 Utest file.txt: unknown status U
Expected result:
Scanning the relevant files for secrets as usual.
The text was updated successfully, but these errors were encountered:
Environment
Describe the bug
It appears that this chain of if-else-statements is missing the case where the status is
U
, meaning that the file is unmerged. This leads to a crash of ggshield when running the pre-commit scan when such a file is present. A file can reach this state during an interactive git merge. I don't believe this situation will occur during a typical pre-commit hook invocation, but it can occur during manual ggshield calls as shown below.Steps to reproduce:
Actual result:
Expected result:
Scanning the relevant files for secrets as usual.
The text was updated successfully, but these errors were encountered: