1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

fix whitespace mode for differentialHunkParser

Summary: I forgot to "set it" from the changeset parser.

Test Plan: made a diff with silly whitespace changes. toggled the various whitespace modes and got appropriate results

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4378
This commit is contained in:
Bob Trahan 2013-01-09 13:28:27 -08:00
parent 84c27ae255
commit f1d7c8fbf8
2 changed files with 8 additions and 0 deletions

View file

@ -530,6 +530,7 @@ final class DifferentialChangesetParser {
$new_file);
$hunk_parser = new DifferentialHunkParser();
$hunk_parser->setWhitespaceMode($this->whitespaceMode);
$hunk_parser->parseHunksForLineData($changeset->getHunks());
$hunk_parser->reparseHunksForSpecialAttributes();
$is_unchanged = $hunk_parser->getIsUnchanged();
@ -552,6 +553,7 @@ final class DifferentialChangesetParser {
// $is_unchanged, $whitelines, $old_text and $new_text are populated
// for synthetic hunks, otherwise they are default values.
$hunk_parser = new DifferentialHunkParser();
$hunk_parser->setWhitespaceMode($this->whitespaceMode);
$hunk_parser->parseHunksForLineData($changeset->getHunks());
$hunk_parser->reparseHunksForSpecialAttributes();

View file

@ -45,6 +45,11 @@ final class DifferentialHunkParser {
return $this;
}
private function getWhitespaceMode() {
if ($this->whitespaceMode === null) {
throw new Exception(
'You must setWhitespaceMode before accessing this data.'
);
}
return $this->whitespaceMode;
}
@ -155,6 +160,7 @@ final class DifferentialHunkParser {
*
* NOTE: this function must be called after
* @{method:parseHunksForLineData}.
* NOTE: you must @{method:setWhitespaceMode} before calling this method.
*/
public function reparseHunksForSpecialAttributes() {
$rebuild_old = array();