Skip to content

Commit

Permalink
Use emptry string if there is no name or email for the commit author
Browse files Browse the repository at this point in the history
Issue #6
  • Loading branch information
peti2001 committed Jul 4, 2019
1 parent 86f22b8 commit 4534817
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/entity/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ def set_commit_stats(self, stats):

def obfuscate(self):
if not self.skip_obfuscation:
md5_hash = md5.md5()
md5_hash.update(self.author_name.encode('utf-8'))
self.author_name = md5_hash.hexdigest()
md5_hash = md5.md5()
md5_hash.update(self.author_email.encode('utf-8'))
self.author_email = md5_hash.hexdigest()
if self.author_name is not None:
md5_hash = md5.md5()
md5_hash.update(self.author_name.encode('utf-8'))
self.author_name = md5_hash.hexdigest()
if self.author_email is not None:
md5_hash = md5.md5()
md5_hash.update(self.author_email.encode('utf-8'))
self.author_email = md5_hash.hexdigest()

def json_ready(self):
changed_files = []
Expand Down
12 changes: 9 additions & 3 deletions src/entity/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ def __init__(self, repo_name, repo, commits):
self.number_of_tags = len(repo.tags)
self.commits = []
for hash in commits:
self.contributors[commits[hash].original_author_name + commits[hash].original_author_email] = {
'name': commits[hash].original_author_name,
'email': commits[hash].original_author_email
name = ""
email = ""
if commits[hash].original_author_name is not None:
name = commits[hash].original_author_name
if commits[hash].original_author_email is not None:
email = commits[hash].original_author_email
self.contributors[name + email] = {
'name': name,
'email': email
}
self.commits.append(commits[hash])

Expand Down

0 comments on commit 4534817

Please sign in to comment.