Skip to content

Commit e0eafc4

Browse files
committed
Fix corruption of the ref logs file
It must only have the first line of the commit messages, not the while multiple line log.
1 parent d5739cd commit e0eafc4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: git/refs/log.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def from_line(cls, line):
114114
newhexsha = info[41:81]
115115
for hexsha in (oldhexsha, newhexsha):
116116
if not cls._re_hexsha_only.match(hexsha):
117-
raise ValueError("Invalid hexsha: %s" % hexsha)
117+
raise ValueError("Invalid hexsha: %r" % (hexsha,))
118118
# END if hexsha re doesn't match
119119
# END for each hexsha
120120

@@ -274,11 +274,12 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
274274
raise ValueError("Shas need to be given in binary format")
275275
# END handle sha type
276276
assure_directory_exists(filepath, is_file=True)
277+
first_line = message.split('\n')[0]
277278
committer = isinstance(config_reader, Actor) and config_reader or Actor.committer(config_reader)
278279
entry = RefLogEntry((
279280
bin_to_hex(oldbinsha).decode('ascii'),
280281
bin_to_hex(newbinsha).decode('ascii'),
281-
committer, (int(time.time()), time.altzone), message
282+
committer, (int(time.time()), time.altzone), first_line
282283
))
283284

284285
lf = LockFile(filepath)

0 commit comments

Comments
 (0)