# HG changeset patch # User Mads Kiilerich # Date 1421858111 -3600 # Node ID 8996b4f57dad1c3aeae9df12452f905a6262186d # Parent 7b7b7262e837541d2f76d00bf7cd7cda97b81d3c git: preserve line endings when calling out to git \r line endings were replaced with \n, and some diffs would thus fail to parse. That would be the cases similar to what was addressed in fbb992c719aa. The leading text would be ignored anyway in diffs.py so there is no need to strip it here. The stripping do also not seem very reliable. But for now we will keep it. diff -r 7b7b7262e837 -r 8996b4f57dad kallithea/lib/vcs/backends/git/repository.py --- a/kallithea/lib/vcs/backends/git/repository.py Wed Jan 21 17:35:11 2015 +0100 +++ b/kallithea/lib/vcs/backends/git/repository.py Wed Jan 21 17:35:11 2015 +0100 @@ -625,17 +625,13 @@ cmd += ' -- "%s"' % path stdout, stderr = self.run_git_command(cmd) + # TODO: don't ignore stderr # If we used 'show' command, strip first few lines (until actual diff # starts) if rev1 == self.EMPTY_CHANGESET: - lines = stdout.splitlines() - x = 0 - for line in lines: - if line.startswith('diff'): - break - x += 1 - # Append new line just like 'diff' command do - stdout = '\n'.join(lines[x:]) + '\n' + parts = stdout.split('\ndiff ', 1) + if len(parts) > 1: + stdout = 'diff ' + parts[1] return stdout @LazyProperty