Changeset - 8996b4f57dad
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-01-21 17:35:11
madski@unity3d.com
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.
1 file changed with 4 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -625,17 +625,13 @@ class GitRepository(BaseRepository):
 
            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
0 comments (0 inline, 0 general)