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

Avoid error in blaming empty file

Summary: Fixes T2389, resolves TODO.

Test Plan: Blamed seemingly binary file.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2389

Differential Revision: https://secure.phabricator.com/D4604
This commit is contained in:
vrana 2013-01-23 15:11:16 -08:00
parent a54a60df36
commit ffd46df597
2 changed files with 4 additions and 6 deletions

View file

@ -467,8 +467,6 @@ final class DiffusionBrowseFileController extends DiffusionController {
// with same color; otherwise generate blame info. The newer a change
// is, the more saturated the color.
// TODO: SVN doesn't always give us blame for the last line, if empty?
// Bug with our stuff or with SVN?
$rev = idx($rev_list, $k, $last_rev);
if ($last_rev == $rev) {

View file

@ -30,17 +30,17 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery {
}
final public function getBlameData() {
$raw_data = $this->getRawData();
$raw_data = preg_replace('/\n$/', '', $this->getRawData());
$text_list = array();
$rev_list = array();
$blame_dict = array();
if (!$this->getNeedsBlame()) {
$text_list = explode("\n", rtrim($raw_data));
} else {
$text_list = explode("\n", $raw_data);
} else if ($raw_data != '') {
$lines = array();
foreach (explode("\n", rtrim($raw_data)) as $k => $line) {
foreach (explode("\n", $raw_data) as $k => $line) {
$lines[$k] = $this->tokenizeLine($line);
list($rev_id, $author, $text) = $lines[$k];