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

fix: use git cli for diff #1409

Merged
merged 8 commits into from
Nov 22, 2023
Merged

fix: use git cli for diff #1409

merged 8 commits into from
Nov 22, 2023

Conversation

didroe
Copy link
Contributor

@didroe didroe commented Nov 20, 2023

Description

Replace go-git with the git CLI. We've seen some issues with the diff output from go-git which is causing diff scans to include unchanged findings.

Also centralises the lookup of Git metadata and uses the flags/options to gather all the inputs.

Testing

  • Regular:
    • Not a git repository
    • No commits
    • No remote
  • Diff:
    • DIFF_BASE_BRANCH implies --diff (for backwards compatibility)
    • Not a git repository
    • No commits
    • No remote
    • Uncommitted changes
    • Custom merge base commit
    • Detached
    • Github
    • Gitlab
  • SaaS:
    • Not a git repository
    • No remote
    • No commits
    • Detached

Related

Checklist

  • I've added test coverage that shows my fix or feature works as expected.
  • I've updated or added documentation if required.
  • I've included usage information in the description if CLI behavior was updated or added.
  • PR title follows Conventional Commits format

@didroe didroe force-pushed the fix/use-git-cli-for-diff branch 6 times, most recently from 205120a to 28e20fd Compare November 22, 2023 11:38
@didroe didroe marked this pull request as ready for review November 22, 2023 13:41
@didroe didroe merged commit 540c4d6 into main Nov 22, 2023
8 checks passed
@didroe didroe deleted the fix/use-git-cli-for-diff branch November 22, 2023 13:41
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.

Bearer scan on uncommitted files Base branch findings are attributed to the wrong head lines
2 participants