@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.

Trim lines before detecting copied/moved code

Test Plan:
https://secure.phabricator.com/differential/diff/4043/
{F10761}

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2352

vrana 2f047dce 4cc61687

+3 -3
+3 -3
src/applications/differential/storage/diff/DifferentialDiff.php
··· 156 156 return $diff; 157 157 } 158 158 159 - public function detectCopiedCode($min_width = 40, $min_lines = 3) { 159 + public function detectCopiedCode($min_width = 30, $min_lines = 3) { 160 160 $map = array(); 161 161 $files = array(); 162 162 $types = array(); ··· 167 167 foreach (explode("\n", $hunk->getChanges()) as $code) { 168 168 $type = (isset($code[0]) ? $code[0] : ''); 169 169 if ($type == '-' || $type == ' ') { 170 - $code = (string)substr($code, 1); 170 + $code = trim(substr($code, 1)); 171 171 $files[$file][$line] = $code; 172 172 $types[$file][$line] = $type; 173 173 if (strlen($code) >= $min_width) { ··· 182 182 foreach ($this->changesets as $changeset) { 183 183 $copies = array(); 184 184 foreach ($changeset->getHunks() as $hunk) { 185 - $added = $hunk->getAddedLines(); 185 + $added = array_map('trim', $hunk->getAddedLines()); 186 186 for (reset($added); list($line, $code) = each($added); next($added)) { 187 187 if (isset($map[$code])) { // We found a long matching line. 188 188 $best_length = 0;