summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-05 15:39:29 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-05 15:39:29 +0100
commitd46e3fe9cb0dea2617cd9231d29bf6919b0f1e91 (patch)
tree58144d970352829823e40f32c95f0ca3da25eb62
parent3936084cdd336ce7db7d693950e345eeceab93a5 (diff)
parent1ef4552404ba3bc92554a6c57793ee889523e3a8 (diff)
downloadgitpython-0.3.tar.gz
Merge pull request #226 from yarikoptic/bf-tab-log-lines0.3
BF: allow log line to have no msg (Close #225)
-rw-r--r--git/refs/log.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/git/refs/log.py b/git/refs/log.py
index e3f3363c..07465e6f 100644
--- a/git/refs/log.py
+++ b/git/refs/log.py
@@ -80,11 +80,15 @@ class RefLogEntry(tuple):
""":return: New RefLogEntry instance from the given revlog line.
:param line: line without trailing newline
:raise ValueError: If line could not be parsed"""
- try:
- info, msg = line.split('\t', 2)
- 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):