From e0eafc47c307ff0bf589ce43b623bd24fad744fd Mon Sep 17 00:00:00 2001 From: Barry Scott Date: Mon, 13 Jun 2016 15:26:18 +0100 Subject: Fix corruption of the ref logs file It must only have the first line of the commit messages, not the while multiple line log. --- git/refs/log.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git/refs/log.py') diff --git a/git/refs/log.py b/git/refs/log.py index fed13608..3078355d 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -114,7 +114,7 @@ class RefLogEntry(tuple): newhexsha = info[41:81] for hexsha in (oldhexsha, newhexsha): if not cls._re_hexsha_only.match(hexsha): - raise ValueError("Invalid hexsha: %s" % hexsha) + raise ValueError("Invalid hexsha: %r" % (hexsha,)) # END if hexsha re doesn't match # END for each hexsha @@ -274,11 +274,12 @@ class RefLog(list, Serializable): raise ValueError("Shas need to be given in binary format") # END handle sha type assure_directory_exists(filepath, is_file=True) + first_line = message.split('\n')[0] committer = isinstance(config_reader, Actor) and config_reader or Actor.committer(config_reader) entry = RefLogEntry(( bin_to_hex(oldbinsha).decode('ascii'), bin_to_hex(newbinsha).decode('ascii'), - committer, (int(time.time()), time.altzone), message + committer, (int(time.time()), time.altzone), first_line )) lf = LockFile(filepath) -- cgit v1.2.1