1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Fix two issues with Differential updates and Owners

Summary:
Ref T13114.

  - Followup fix for D19267, which didn't work correctly with //new// revision creation.
  - Followup fix for changes in T11015. Some of the querying logic was still handling "/x.y" and "/x.y/" differently. Instead, normalize consistently to "/x.y/"

Test Plan:
  - Created a new revision cleanly.
  - Created a package owning only a `example.txt` file and saw Differential find it as an owning package in the table of contents.

Maniphest Tasks: T13114

Differential Revision: https://secure.phabricator.com/D19268
This commit is contained in:
epriestley 2018-03-29 11:22:02 -07:00
parent 93cb6e3bde
commit 7915445543
2 changed files with 15 additions and 10 deletions

View file

@ -137,7 +137,9 @@ final class DifferentialRevisionUpdateTransaction
continue; continue;
} }
$is_attached = ($diff->getRevisionID() == $object->getID()); $is_attached =
($diff->getRevisionID()) &&
($diff->getRevisionID() == $object->getID());
if ($is_attached) { if ($is_attached) {
$is_active = ($diff_phid == $object->getActiveDiffPHID()); $is_active = ($diff_phid == $object->getActiveDiffPHID());
} else { } else {

View file

@ -393,19 +393,22 @@ final class PhabricatorOwnersPackage
} }
public static function splitPath($path) { public static function splitPath($path) {
$trailing_slash = preg_match('@/$@', $path) ? '/' : ''; $result = array(
$path = trim($path, '/'); '/',
);
$parts = explode('/', $path); $parts = explode('/', $path);
$buffer = '/';
foreach ($parts as $part) {
if (!strlen($part)) {
continue;
}
$result = array(); $buffer = $buffer.$part.'/';
while (count($parts)) { $result[] = $buffer;
$result[] = '/'.implode('/', $parts).$trailing_slash;
$trailing_slash = '/';
array_pop($parts);
} }
$result[] = '/';
return array_reverse($result); return $result;
} }
public function attachPaths(array $paths) { public function attachPaths(array $paths) {