@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix computing line numbers in diff of diffs

Test Plan: Live in prod.

Auditors: jungejason

vrana a2f4d661 99df72b8

+11 -8
+11 -8
src/applications/differential/parser/DifferentialChangesetParser.php
··· 133 133 $n_new = $hunk->getNewOffset(); 134 134 $changes = rtrim($hunk->getChanges(), "\n"); 135 135 foreach (explode("\n", $changes) as $line) { 136 - $type = $line[1]; // Change type in the original diff. 137 - if ($line[0] == ' ') { 136 + $diff_type = $line[0]; // Change type in diff of diffs. 137 + $orig_type = $line[1]; // Change type in the original diff. 138 + if ($diff_type == ' ') { 138 139 // Use the same key for lines that are next to each other. 139 140 $key = max(last_key($olds), last_key($news)) + 1; 140 141 $olds[$key] = null; 141 142 $news[$key] = null; 143 + } else if ($diff_type == '-') { 144 + $olds[] = array($n_old, $orig_type); 145 + } else if ($diff_type == '+') { 146 + $news[] = array($n_new, $orig_type); 147 + } 148 + if (($diff_type == '-' || $diff_type == ' ') && $orig_type != '-') { 142 149 $n_old++; 143 - $n_new++; 144 - } else if ($line[0] == '-') { 145 - $olds[] = array($n_old, $type); 146 - $n_old++; 147 - } else if ($line[0] == '+') { 148 - $news[] = array($n_new, $type); 150 + } 151 + if (($diff_type == '+' || $diff_type == ' ') && $orig_type != '-') { 149 152 $n_new++; 150 153 } 151 154 }