Skip to content

Guard against exceptions when commits is None due to extension filtering #149

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

Closed
wants to merge 2 commits into from
Closed

Guard against exceptions when commits is None due to extension filtering #149

wants to merge 2 commits into from

Conversation

neontapir
Copy link

@neontapir neontapir commented Apr 18, 2017

I found when using the -f flag that if I did not have any files that matched the -f arguments, I would get exceptions because self.commits contained NoneType commits. This patch prevents that situation from occurring through guard clauses and filtering out those unwanted entries.

Here's an example of the error:

$ git inspector -f md
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/neontapir/git/github/neontapir/gitinspector/gitinspector/changes.py", line 170, in run
    commit.add_filediff(filediff)
AttributeError: 'NoneType' object has no attribute 'add_filediff'

@adam-waldenberg
Copy link
Member

@neontapir Does this still occur with the latest version of the master branch ? I am unable to reproduce it.

@neontapir
Copy link
Author

@adam-waldenberg it looks fixed. I was unable to reproduce after pulling the latest.

@neontapir neontapir closed this May 31, 2017
@adam-waldenberg adam-waldenberg added this to the 0.4.5 milestone Jun 1, 2017
@adam-waldenberg
Copy link
Member

@neontapir Great!

@adam-waldenberg adam-waldenberg modified the milestones: 0.4.5, 0.5.0 Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants