Skip to content

Handle empty git repos #46

Merged
KevinHock merged 3 commits intoYelp:masterfrom
sp3nx0r:empty_git_alt
Jan 28, 2020
Merged

Handle empty git repos #46
KevinHock merged 3 commits intoYelp:masterfrom
sp3nx0r:empty_git_alt

Conversation

@sp3nx0r
Copy link
Copy Markdown
Contributor

@sp3nx0r sp3nx0r commented Jan 27, 2020

Addresses Issue #19

Two changes:

  1. Add exception catching for _git() for two scenarios: A) initial add (fails on getting HEAD) and B) scan with empty commit hashes
  2. Add code to handle scanning an empty repo and update said repo if it does flip to non-empty in scan.py. This also required a change in _clone_and_save_repo() to allow an update to existing metadata.

Unintended side effect was having to change the test case for existing metadata. I flipped it to testing for allowing update because my mocking blows and I couldn't figure out how to easily add a repo.last_commit_hash so it wouldn't take the empty repo path.

@sp3nx0r sp3nx0r requested a review from KevinHock January 27, 2020 17:01
Copy link
Copy Markdown
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great to me, thank you for making this!

Asked for one clarification, but that's all.

Comment thread detect_secrets_server/actions/scan.py Outdated
@KevinHock KevinHock merged commit 5d6224e into Yelp:master Jan 28, 2020
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.

2 participants