Package: trac-git Version: 0.12.0.5+722342e-1 Severity: important Tags: upstream patch
Dear Maintainer, after gpg signed commit to the git repository, the browse source and the Journal could not be shown with the above mentioned error. See upstream bug reports http://trac.edgewall.org/ticket/10676 and http://trac.edgewall.org/ticket/11908. Fixed in trac 1.0 but seems to be not merged back into trac-git plugin from trac 0.12. But the attached patch fixes it in current debian stable version of trac-git package. The debsums error below is caused by the already patched version of the file. Kind regards, Joachim Langenbach -- System Information: Debian Release: 7.7 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages trac-git depends on: ii git [git-core] 1:1.7.10.4-1+wheezy1 ii git-core 1:1.7.10.4-1+wheezy1 ii python 2.7.3-4+deb7u1 ii python2.7 2.7.3-6+deb7u2 ii trac 0.12.5-3~deb7u1 trac-git recommends no packages. trac-git suggests no packages. -- no debconf information -- debsums errors found: debsums: changed file /usr/share/pyshared/tracext/git/PyGIT.py (from trac-git package)
diff -rupN git.old/PyGIT.py git/PyGIT.py --- git.old/PyGIT.py 2015-01-10 13:29:13.425013137 +0100 +++ git/PyGIT.py 2015-01-10 13:27:09.108148361 +0100 @@ -26,6 +26,37 @@ class GitError(Exception): class GitErrorSha(GitError): pass +# Helper functions + +def parse_commit(raw): + """Parse the raw content of a commit (as given by `git cat-file -p <rev>`). + + Return the commit message and a dict of properties. + """ + if not raw: + raise GitErrorSha + lines = raw.splitlines() + if not lines: + raise GitErrorSha + line = lines.pop(0) + props = {} + multiline = multiline_key = None + while line: + if line[0] == ' ': + if not multiline: + multiline_key = key + multiline = [props[multiline_key][-1]] + multiline.append(line[1:]) + else: + key, value = line.split(None, 1) + props.setdefault(key, []).append(value.strip()) + line = lines.pop(0) + if multiline and (not line or key != multiline_key): + props[multiline_key][-1] = '\n'.join(multiline) + multiline = None + return '\n'.join(lines), props + + class GitCore(object): """ Low-level wrapper around git executable @@ -638,19 +669,8 @@ class Storage(object): # cache miss raw = self.cat_file("commit", commit_id) raw = unicode(raw, self.get_commit_encoding(), 'replace') - lines = raw.splitlines() - - if not lines: - raise GitErrorSha - - line = lines.pop(0) - props = {} - while line: - key, value = line.split(None, 1) - props.setdefault(key, []).append(value.strip()) - line = lines.pop(0) - result = ("\n".join(lines), props) + result = parse_commit(raw) self.__commit_msg_cache[commit_id] = result