mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42: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:
parent
a54a60df36
commit
ffd46df597
2 changed files with 4 additions and 6 deletions
|
@ -467,8 +467,6 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||||
// with same color; otherwise generate blame info. The newer a change
|
// with same color; otherwise generate blame info. The newer a change
|
||||||
// is, the more saturated the color.
|
// 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);
|
$rev = idx($rev_list, $k, $last_rev);
|
||||||
|
|
||||||
if ($last_rev == $rev) {
|
if ($last_rev == $rev) {
|
||||||
|
|
|
@ -30,17 +30,17 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getBlameData() {
|
final public function getBlameData() {
|
||||||
$raw_data = $this->getRawData();
|
$raw_data = preg_replace('/\n$/', '', $this->getRawData());
|
||||||
|
|
||||||
$text_list = array();
|
$text_list = array();
|
||||||
$rev_list = array();
|
$rev_list = array();
|
||||||
$blame_dict = array();
|
$blame_dict = array();
|
||||||
|
|
||||||
if (!$this->getNeedsBlame()) {
|
if (!$this->getNeedsBlame()) {
|
||||||
$text_list = explode("\n", rtrim($raw_data));
|
$text_list = explode("\n", $raw_data);
|
||||||
} else {
|
} else if ($raw_data != '') {
|
||||||
$lines = array();
|
$lines = array();
|
||||||
foreach (explode("\n", rtrim($raw_data)) as $k => $line) {
|
foreach (explode("\n", $raw_data) as $k => $line) {
|
||||||
$lines[$k] = $this->tokenizeLine($line);
|
$lines[$k] = $this->tokenizeLine($line);
|
||||||
|
|
||||||
list($rev_id, $author, $text) = $lines[$k];
|
list($rev_id, $author, $text) = $lines[$k];
|
||||||
|
|
Loading…
Reference in a new issue