diff options
author | Barry Scott <barry@barrys-emacs.org> | 2016-06-13 15:26:18 +0100 |
---|---|---|
committer | Barry Scott <barry@barrys-emacs.org> | 2016-06-13 15:26:18 +0100 |
commit | e0eafc47c307ff0bf589ce43b623bd24fad744fd (patch) | |
tree | 9d44f83d343df39db35010eadc8c8e4165cfccd9 | |
parent | d5739cd466f77a60425bd2860895799f7c9359d9 (diff) | |
download | gitpython-e0eafc47c307ff0bf589ce43b623bd24fad744fd.tar.gz |
Fix corruption of the ref logs file
It must only have the first line of the
commit messages, not the while multiple line log.
-rw-r--r-- | git/refs/log.py | 5 |
1 files changed, 3 insertions, 2 deletions
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) |