Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle trailing content in multi-parent hunk header #1033

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sevbch
Copy link

@sevbch sevbch commented Dec 13, 2024

Context

When running a scan on a multi-parent commit with a hunk header with a trailing content, parsing of the header would fail and raise a PatchParseError.

This PR relates to #1022.

What has been done

Handle trailing content in the regex used to parse multi-parent hunk header.

Validation

  • Using previous version, on this repo
ggshield secret scan commit-range eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f^..eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f
Error: Could not parse patch (sha: eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f): Failed to parse multi-parent hunk header '@@@ -23,37 -22,21 +23,52 @@@ from ggshield.core.types import Ignored'
Error: Could not parse patch (sha: eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f): Failed to parse multi-parent hunk header '@@@ -23,37 -22,21 +23,52 @@@ from ggshield.core.types import Ignored'
Error: Could not parse patch (sha: eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f): Failed to parse multi-parent hunk header '@@@ -23,37 -22,21 +23,52 @@@ from ggshield.core.types import Ignored'
Error: Could not parse patch (sha: eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f): Failed to parse multi-parent hunk header '@@@ -23,37 -22,21 +23,52 @@@ from ggshield.core.types import Ignored'
Error: Could not parse patch (sha: eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f): Failed to parse multi-parent hunk header '@@@ -23,37 -22,21 +23,52 @@@ from ggshield.core.types import Ignored'
Scanning... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 5 / 5

No secrets have been found
  • On this branch
ggshield secret scan commit-range eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f^..eb052f92b8bdaf0b32b9de1f1bc8c9493496c50f
Scanning... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 5 / 5

No secrets have been found

PR check list

  • As much as possible, the changes include tests (unit and/or functional)
  • If the changes affect the end user (new feature, behavior change, bug fix) then the PR has a changelog entry (see doc/dev/getting-started.md). If the changes do not affect the end user, then the skip-changelog label has been added to the PR.

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.05%. Comparing base (6d0d8b8) to head (c2355f1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1033   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files         181      181           
  Lines        7726     7729    +3     
=======================================
+ Hits         7112     7115    +3     
  Misses        614      614           
Flag Coverage Δ
unittests 92.05% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sevbch sevbch self-assigned this Dec 13, 2024
@sevbch sevbch marked this pull request as ready for review December 13, 2024 17:53
@sevbch sevbch requested a review from a team as a code owner December 13, 2024 17:53
@sevbch sevbch changed the title fix(commit_utils): Handle trailing content in multi-parent hunk header Handle trailing content in multi-parent hunk header Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant