diff options
Diffstat (limited to 'git/refs/log.py')
-rw-r--r-- | git/refs/log.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/git/refs/log.py b/git/refs/log.py index 69189b51..7708dd73 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -84,12 +84,16 @@ class RefLogEntry(tuple): """:return: New RefLogEntry instance from the given revlog line. :param line: line bytes without trailing newline :raise ValueError: If line could not be parsed""" - line = line.decode(defenc) - try: - info, msg = line.split('\t', 1) - except ValueError: - raise ValueError("line is missing tab separator") - # END handle first plit + fields = line.split('\t', 1) + if len(fields) == 1: + info, msg = fields[0], None + elif len(fields) == 2: + info, msg = fields + else: + raise ValueError("Line must have up to two TAB-separated fields." + " Got %s" % repr(line)) + # END handle first split + oldhexsha = info[:40] newhexsha = info[41:81] for hexsha in (oldhexsha, newhexsha): |