summaryrefslogtreecommitdiff
path: root/lib/git/actor.py
diff options
context:
space:
mode:
authorunknown <Byron@.(none)>2009-11-06 14:22:43 +0100
committerunknown <Byron@.(none)>2009-11-06 14:22:43 +0100
commit1f4bc8ee9aeeec8bf7aa31c627e50761dd8bb2db (patch)
tree71ddf6bddbf835e39a247e9bd2fd1f3f58e76648 /lib/git/actor.py
parenta4d06724202afccd2b5c54f81bcf2bf26dea7fff (diff)
downloadgitpython-1f4bc8ee9aeeec8bf7aa31c627e50761dd8bb2db.tar.gz
Actor: fixed incorrect parsing of names from lines in case there was no email address specified
Diffstat (limited to 'lib/git/actor.py')
-rw-r--r--lib/git/actor.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/git/actor.py b/lib/git/actor.py
index 04872f1c..5de55b8d 100644
--- a/lib/git/actor.py
+++ b/lib/git/actor.py
@@ -11,7 +11,7 @@ class Actor(object):
can be committers and authors or anything with a name and an email as
mentioned in the git log entries."""
# precompiled regex
- name_only_regex = re.compile( r'<.+>' )
+ name_only_regex = re.compile( r'<(.+)>' )
name_email_regex = re.compile( r'(.*) <(.+?)>' )
def __init__(self, name, email):
@@ -47,9 +47,16 @@ class Actor(object):
Returns
Actor
"""
- if cls.name_only_regex.search(string):
- m = cls.name_email_regex.search(string)
+ m = cls.name_email_regex.search(string)
+ if m:
name, email = m.groups()
return Actor(name, email)
else:
- return Actor(string, None)
+ m = cls.name_only_regex.search(string)
+ if m:
+ return Actor(m.group(1), None)
+ else:
+ # assume best and use the whole string as name
+ return Actor(string, None)
+ # END special case name
+ # END handle name/email matching