From 10659ece8e2d0be3f1b0dee065d7eebcd174e5ad Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Mon, 4 Nov 2013 15:03:07 -0800 Subject: [PATCH] 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 --- .../DiffusionRepositoryEditMainController.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index 2b71b1b26f..db5dc9c65d 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -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(