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

Fix bugs when saving package changes due to commit changes

Summary:
Because of the way PhabricatorOwnersPackage works, the code to save package
changes when parsing commit changes was raising a few undefined index errors,
and was throwing an exception trying to call a method on null (because not
all of the phids related to the package had their handles loaded). This fix
doesn't load the missing handles, it just avoids trying to use them.

Test Plan:
./scripts/repository/reparse.php on a commit with path changes that triggered
a package change

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4236
This commit is contained in:
Nick Harper 2012-12-19 10:53:04 -08:00
parent 93c4030732
commit b8d372c4bc
2 changed files with 2 additions and 1 deletions

View file

@ -268,7 +268,7 @@ final class PhabricatorOwnersPackage extends PhabricatorOwnersDAO
$path->getPath(),
array()));
$excluded = $path->getExcluded();
if (!$new_path || $new_path['excluded'] != $excluded) {
if (!$new_path || idx($new_path, 'excluded') != $excluded) {
$touched_repos[$repository_phid] = true;
$remove_paths[$repository_phid][$path->getPath()] = $excluded;
$path->delete();

View file

@ -91,6 +91,7 @@ final class PhabricatorOwnersPackagePathValidator {
}
if ($new_paths) {
$package->attachOldPrimaryOwnerPHID($package->getPrimaryOwnerPHID());
$package->attachUnsavedPaths($new_paths);
$package->save(); // save the changes and notify the owners.
}