mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Fix arc handling of "\n" files on Windows in SVN
Summary: On Windows, a diff may have "\n" newlines (from the file itself) but "\r\n" blocks (from svn). NOTE: indents are funky since I edited this with Notepad++, I'll fix before landing. Test Plan: Diffed an edit to a "\n" newline file on Windows in SVN. Reviewers: btrahan, vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D2998
This commit is contained in:
parent
f649837785
commit
9997dd7830
1 changed files with 6 additions and 6 deletions
|
@ -991,13 +991,13 @@ final class ArcanistDiffParser {
|
||||||
$text = preg_replace('/'.$ansi_color_pattern.'/', '', $text);
|
$text = preg_replace('/'.$ansi_color_pattern.'/', '', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is a hack for SVN + Windows.
|
// TODO: This is a hack for SVN + Windows. Eventually, we should retain line
|
||||||
if (strpos($text, "\r\n") !== false) {
|
// endings and preserve them through the patch lifecycle or something along
|
||||||
$this->text = explode("\r\n", $text);
|
// those lines.
|
||||||
} else {
|
|
||||||
$this->text = explode("\n", $text);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// NOTE: On Windows, a diff may have \n delimited lines (because the file
|
||||||
|
// uses \n) but \r\n delimited blocks. Split on both.
|
||||||
|
$this->text = preg_split('/\r?\n/', $text);
|
||||||
$this->line = 0;
|
$this->line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue