1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 05:42:40 +01:00

Warn when 'git-http-backend' is not on the PATH.

Summary:
Currently if 'git-http-backend' is not on the PATH, there is no visible message to the user other than "info/refs: is this a valid git repository?" when trying to clone.  This adds a setup check so that if there are any Git repositories in use, it will check for the existance of the "git-http-backend" binary in the PATH.

I believe this is shipped by default alongside the git package on most distros, but in some (such as OpenSUSE), this binary isn't on the PATH by default.

Test Plan: Removed `/usr/lib/git` from my `environment.append-paths` and saw the message appear.  Added it back and the message went away.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4050

Differential Revision: https://secure.phabricator.com/D7488
This commit is contained in:
James Rhodes 2013-11-04 15:03:07 -08:00 committed by epriestley
parent 4f20530856
commit 10659ece8e

View file

@ -597,6 +597,64 @@ final class DiffusionRepositoryEditMainController
return $view;
}
if ($repository->isHosted()) {
$binaries = array();
if ($repository->getServeOverHTTP() != PhabricatorRepository::SERVE_OFF) {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$binaries['Git HTTP serve'] = 'git-http-backend';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$binaries['SVN serve'] = 'svnserve';
$binaries['SVN admin'] = 'svnadmin';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$binaries['Mercurial'] = 'hg';
break;
}
}
if ($repository->getServeOverSSH() != PhabricatorRepository::SERVE_OFF) {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$binaries['Git SSH receive'] = 'git-receive-pack';
$binaries['Git SSH upload'] = 'git-upload-pack';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$binaries['SVN serve'] = 'svnserve';
$binaries['SVN admin'] = 'svnadmin';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$binaries['Mercurial'] = 'hg';
break;
}
}
$binaries = array_unique($binaries);
foreach ($binaries as $name => $binary) {
if (!Filesystem::binaryExists($binary)) {
$view->addItem(
id(new PHUIStatusItemView())
->setIcon('warning-red')
->setTarget(pht(
'%s tool not found in PATH',
$name))
->setNote(pht(
'You may need to configure %s.',
phutil_tag('tt', array(), 'environment.append-paths'))));
} else {
$view->addItem(
id(new PHUIStatusItemView())
->setIcon('accept-green')
->setTarget(pht(
'%s tool found',
$name))
->setNote(phutil_tag(
'tt',
array(),
Filesystem::resolveBinary($binary))));
}
}
}
$doc_href = PhabricatorEnv::getDocLink(
'article/Managing_Daemons_with_phd.html');
$daemon_instructions = pht(