From 9392fc695c180fe7ec89792bff88e596297cb8c1 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 13 2017 21:43:14 +0000 Subject: Don't add contributor's name if email is not found All we look for while going through the commits of a project is the emails and if we don't find that. There is no point of entering their name --- diff --git a/pagure_importer/utils/__init__.py b/pagure_importer/utils/__init__.py index e42ecf4..3cc16b4 100644 --- a/pagure_importer/utils/__init__.py +++ b/pagure_importer/utils/__init__.py @@ -114,12 +114,13 @@ def gh_get_contributors(github_username, github_password, github_project_name): project_commits = project.get_commits() contributors = [] for commit in project_commits: - contributor = {'fullname': commit.author.name, - 'emails': commit.commit.author.email, - 'name': commit.author.login} - if contributor not in contributors: - contributors.append(contributor) - click.echo('contributor added: ' + contributor['name']) + if commit.author is not None and commit.author.email is not None: + contributor = {'fullname': commit.author.name, + 'emails': commit.commit.author.email, + 'name': commit.author.login} + if contributor not in contributors: + contributors.append(contributor) + click.echo('contributor added: ' + contributor['name']) with open('contributors.json', 'w') as f: f.write(json.dumps(contributors))