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

Add error message running "lipsum generate owners" with no repositories

Summary:
First check if a repository exists before trying to call `getPHID()` on `null`.

Closes T15083

Test Plan:
* Have some repositories; run `./bin/lipsum generate owners` and see it still works
* Probably have no repositories; run `./bin/lipsum generate owners` and see it fail (I did not test)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15083

Differential Revision: https://we.phorge.it/D26169

+8 -2
+8 -2
src/applications/owners/lipsum/PhabricatorOwnersPackageTestDataGenerator.php
··· 55 55 $paths = explode("\n", $paths); 56 56 $paths = array_unique($paths); 57 57 58 - $repository_phid = $this->loadOneRandom('PhabricatorRepository') 59 - ->getPHID(); 58 + $repository = $this->loadOneRandom('PhabricatorRepository'); 59 + if (!$repository) { 60 + throw new Exception( 61 + pht( 62 + 'Failed to load a random repository. You may need to generate more '. 63 + 'test repositories first.')); 64 + } 65 + $repository_phid = $repository->getPHID(); 60 66 61 67 $paths_value = array(); 62 68 foreach ($paths as $path) {