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

feat: use libgit2 for parsing git information in mitre/git plugin #663

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patrickjcasey
Copy link
Contributor

This pull request removes the need for a custom nom-based parser for parsing git information in the mitre/git plugin, by swapping over to using libgit2 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 of hc on my M1 Macbook Pro with 32 GB RAM, the mitre/git plugin was also configured to run the release version:

time ./target/release/hc check --policy config/Hipcheck.kdl <REPO>

for testing main, commit 7b2e5a5629928cc448a7cfee56178370d4f32cc3 was used

Branch Repo # of Commits # of CommitDiffs # of Contributors Last Commit Execution Speed
main mitre/hipcheck 502 502 19 2024-11-25T07:04:37Z 11.45 s
libgit2 mitre/hipcheck 502 502 19 2024-11-25T07:04:37Z 10.19 s
main numpy/numpy 28386 28386 1897 2024-11-25T21:22:49Z 4m 40s
libgit2 numpy/numpy 37551 37551 2239 2024-11-25T14:22:49Z 12m 50s
main torvalds/linux
libgit2 torvalds/linux 1320823 1320823 38849

git rev-list --count HEAD results:

  • numpy/numpy: 37751 is returned, which matches the libgit2 implementation
  • torvalds/linux: 1320823 is returned, which matches the libgit2 implementation

git log --pretty="%an %ae%n%cn %ce" | LC_ALL=C sort -u | wc -l results:
numpy/numpy: 2239 is returned, which matches libgit2 implementation
torvalds/linux: 38855 is returned, which is off by 6 from the libgit2 implementation

@patrickjcasey patrickjcasey force-pushed the patrickjcasey/replace-nom-parser-with-libgit2 branch from fa18ac5 to dbb86eb Compare November 26, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

explore replacing plugins/git nom parser with libgit2 function calls
1 participant