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

Log repositories with a non-existing default branch

Summary:
There are cases when repositories mirrored into Diffusion change their default branch name (e.g. from master to main) and delete the previous default branch.
In such cases, Diffusion already renders an error message in the UI.
As a Phorge admin, I am interested in getting aware of such issues so I could fix repository settings.
Thus also add an error to the error log in such cases.

Closes T16215

Test Plan:
1. Have an existing Diffusion Repository set up to mirror an external, canonical codebase with its main branch named "master"
2. Go to https://phabricator.wikimedia.org/source/somereponame/manage/branches/, click "Edit Branches", change the default branch from "master" to a non-existing branch
3. Go to https://phabricator.wikimedia.org/source/somereponame/repository/master/ and get an error message in the UI (no change) and in the logs (due to this patchset)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16215

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

+5
+5
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 74 74 'This repository is configured with default branch "%s" but '. 75 75 'there is no branch with that name in this repository.', 76 76 $default); 77 + $branch_setup_uri = $this->getApplicationURI( 78 + 'edit/'.$repository->getID().'/page/branches/'); 79 + phlog('Repository "'.$repository->getName().'" is configured with '. 80 + 'default branch "'.$default.'" but there is no such branch in '. 81 + 'this repository. Correct the settings at '.$branch_setup_uri); 77 82 } 78 83 } 79 84 }