Skip to content

Commit

Permalink
try catch StopIteration [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Jun 11, 2019
1 parent 927f1a9 commit a0a6fc3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dev/tasks/crossbow.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,17 @@ def remote_url(self):

@property
def user_name(self):
name = os.environ.get('GIT_COMMITTER_NAME', 'unkown')
return next(self.repo.config.get_multivar('user.name') or [name])
try:
return next(self.repo.config.get_multivar('user.name'))
except StopIteration:
return os.environ.get('GIT_COMMITTER_NAME', 'unkown')

@property
def user_email(self):
email = os.environ.get('GIT_COMMITTER_EMAIL', 'unkown')
return next(self.repo.config.get_multivar('user.email') or [email])
try:
return next(self.repo.config.get_multivar('user.email'))
except StopIteration:
return os.environ.get('GIT_COMMITTER_EMAIL', 'unkown')

@property
def signature(self):
Expand Down

0 comments on commit a0a6fc3

Please sign in to comment.