1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 22:10:54 +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:
epriestley 2012-07-18 06:53:07 -07:00
parent f649837785
commit 9997dd7830

View file

@ -991,13 +991,13 @@ final class ArcanistDiffParser {
$text = preg_replace('/'.$ansi_color_pattern.'/', '', $text);
}
// TODO: This is a hack for SVN + Windows.
if (strpos($text, "\r\n") !== false) {
$this->text = explode("\r\n", $text);
} else {
$this->text = explode("\n", $text);
}
// TODO: This is a hack for SVN + Windows. Eventually, we should retain line
// endings and preserve them through the patch lifecycle or something along
// those lines.
// 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;
}