feat: use libgit2 for parsing git information in mitre/git plugin #663
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request removes the need for a custom
nom
-based parser for parsing git information in themitre/git
plugin, by swapping over to usinglibgit2
for parsing git information. As a part of this change, I got some data from the following repos:for determining execution speed, the following command was run with the
release
version ofhc
on my M1 Macbook Pro with 32 GB RAM, themitre/git
plugin was also configured to run therelease
version:time ./target/release/hc check --policy config/Hipcheck.kdl <REPO>
for testing
main
, commit7b2e5a5629928cc448a7cfee56178370d4f32cc3
was usedmain
mitre/hipcheck
libgit2
mitre/hipcheck
main
numpy/numpy
libgit2
numpy/numpy
main
torvalds/linux
libgit2
torvalds/linux
git rev-list --count HEAD
results:numpy/numpy
: 37751 is returned, which matches thelibgit2
implementationtorvalds/linux
: 1320823 is returned, which matches thelibgit2
implementationgit log --pretty="%an %ae%n%cn %ce" | LC_ALL=C sort -u | wc -l
results:numpy/numpy
: 2239 is returned, which matcheslibgit2
implementationtorvalds/linux
: 38855 is returned, which is off by 6 from thelibgit2
implementation