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 commit parent handling #284

Merged
merged 4 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
vx.y.z - TBD
------------

Bug fixes:

* [#284](https://github.com/godaddy/tartufo/pull/284) - Fix handling of first
commit during local scans; an exception was raised instead of processing the
commit.

Features:

* [#270](https://github.com/godaddy/tartufo/issues/270) - When no refs/branches
Expand Down
4 changes: 3 additions & 1 deletion tartufo/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ def chunks(self) -> Generator[types.Chunk, None, None]:
for curr_commit in commits:
try:
prev_commit = curr_commit.parents[0]
except (KeyError, TypeError):
except (IndexError, KeyError, TypeError):
# IndexError: current commit has no parents
# KeyError: current commit has parents which are not local
# If a commit doesn't have a parent skip diff generation since it is the first commit
self.logger.debug(
"Skipping commit %s because it has no parents", curr_commit.hex
Expand Down