Skip to content

Commit 007bd4b

Browse files
committed
Fixed parse_actor_and_date with mangled tags
1 parent 0e9eef4 commit 007bd4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎git/objects/util.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,21 @@ def parse_date(string_date):
167167

168168
# precompiled regex
169169
_re_actor_epoch = re.compile(r'^.+? (.*) (\d+) ([+-]\d+).*$')
170+
_re_only_actor = re.compile(r'^.+? (.*)$')
170171

171172
def parse_actor_and_date(line):
172173
"""Parse out the actor (author or committer) info from a line like::
173174
174175
author Tom Preston-Werner <tom@mojombo.com> 1191999972 -0700
175176
176177
:return: [Actor, int_seconds_since_epoch, int_timezone_offset]"""
178+
actor, epoch, offset = '', 0, 0
177179
m = _re_actor_epoch.search(line)
178-
actor, epoch, offset = m.groups()
180+
if m:
181+
actor, epoch, offset = m.groups()
182+
else:
183+
m = _re_only_actor.search(line)
184+
actor = m.group(1) if m else line or ''
179185
return (Actor._from_string(actor), int(epoch), utctz_to_altz(offset))
180186

181187

0 commit comments

Comments
 (0)