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

Support Git renames in the middle of path

Test Plan: Blame previous revision with such rename.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

vrana a8b5ca63 ee916859

+21 -6
+21 -6
src/applications/diffusion/query/renamehistory/DiffusionGitRenameHistoryQuery.php
··· 44 44 list($action, $info) = explode(' ', $line, 2); 45 45 switch ($action) { 46 46 case 'rename': 47 - // rename path/to/file/{old.ext => new.ext} (86%) 47 + // We support these cases: 48 + // rename README => README.txt (100%) 49 + // rename src/README => README (100%) 50 + // rename src/{README => README.txt} (100%) 51 + // rename {resources => rsrc}/README (100%) 52 + // rename src/{aphront => }/README (100%) 53 + // rename src/{ => aphront}/README (100%) 54 + // rename src/{docs => ducks}/README (100%) 48 55 $matches = null; 49 56 $ok = preg_match( 50 - '/^(.*){(.*) => (.*)} \([0-9%]+\)$/', 57 + '/^(.*){(.*) => (.*)}(.*) \([0-9%]+\)$/', 51 58 $info, 52 59 $matches); 53 - if (!$ok) { 54 - throw new Exception( 55 - "Unparseable git log --summary line: {$line}."); 60 + if ($ok) { 61 + $name = $matches[1].ltrim($matches[2].$matches[4], '/'); 62 + } else { 63 + $ok = preg_match( 64 + '/^(.*) => (.*) \([0-9%]+\)$/', 65 + $info, 66 + $matches); 67 + if (!$ok) { 68 + throw new Exception( 69 + "Unparseable git log --summary line: {$line}."); 70 + } 71 + $name = $matches[1]; 56 72 } 57 73 58 - $name = $matches[1].$matches[2]; 59 74 break; 60 75 case 'create': 61 76 // create mode 100644 <filename>