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

Fix line count in diffs with more hunks per changeset

Summary: This error usually doesn't occur because we have only one hunk per changeset most of the time.

Test Plan:
  $hunk = new ArcanistDiffHunk();
  $hunk->setAddLines(1);
  $hunk->setDelLines(1);

  $change = new ArcanistDiffChange();
  $change->addHunk($hunk);
  $change->addHunk($hunk);

  $diff = DifferentialDiff::newFromRawChanges(array($change));
  var_dump($diff->getLineCount());

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2878
This commit is contained in:
vrana 2012-06-27 14:45:37 -07:00
parent 692e54ee36
commit 6c1c3c3a7a

View file

@ -147,8 +147,8 @@ final class DifferentialDiff extends DifferentialDAO {
$changeset->addUnsavedHunk($dhunk);
$add_lines += $hunk->getAddLines();
$del_lines += $hunk->getDelLines();
$lines += $add_lines + $del_lines;
}
$lines += $add_lines + $del_lines;
} else {
// This happens when you add empty files.
$changeset->attachHunks(array());