Closed agateau-gg closed 9 months ago
Attention: 7 lines
in your changes are missing coverage. Please review.
Comparison is base (
2b86fe2
) 91.97% compared to head (6afd8d4
) 92.01%.
Files | Patch % | Lines |
---|---|---|
ggshield/core/scan/commit_utils.py | 93.20% | 7 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description
This PR is the last one of the patch parser refactoring. It changes the way the patch parser reads commits: instead of reading the modifications all at once, it batches them by group of 20 files by default, using
git show --raw -z -m --patch $sha -- $file1 $file2 (...)
.Subtlety
There is one subtlety though: if a file is renamed, then it's important that the call to
git show
includes both the old and the new paths, otherwise the file is not correctly categorized: it is identified as new instead of renamed. This causes issues down the line. This causes some tests to fail after the first commit of the branch.This subtlety required reworking the way we list files: in the previous iteration CommitInformation listed only the path and its status, using the
--name-status
option ofgit show
, but that does not provide information about renames. With this branch, CommitInformation now gets headers formatted the same way Commit gets them, giving it the required information. This also allows sharing the parsing code between Commit and CommitInformation. To do so more easily, they both use a new modulecommit_utils
which contains the parsing code.Review
Another large PR, sorry for that. Again best reviewed commit by commit.