Page MenuHomePhabricator
Paste P1010

pathenv.diff
ActivePublic

Authored by epriestley on Nov 28 2013, 4:55 AM.
Tags
None
Referenced Files
F85685: pathenv.diff
Nov 28 2013, 4:55 AM
Subscribers
None
diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
index e5ec3bb..5f75264 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
@@ -287,6 +287,23 @@ final class PhabricatorRepositoryPullEngine
* @task git
*/
private function installGitHook() {
+ $repository = $this->getRepository();
+ $path = $repository->getLocalPath();
+
+ if ($repository->isWorkingCopyBare()) {
+ $path .= '/hooks/pre-receive';
+ } else {
+ $path .= '/.git/hooks/pre-receive';
+ }
+
+ $root = dirname(phutil_get_library_root('phabricator'));
+ $bin = $root.'/bin/commit-hook';
+
+ $hook = "#!/bin/sh\n".
+ "exec {$bin} {$callsign}\n";
+
+ $this->installHook($path, $hook);
+ }
/* -( Pulling Mercurial Working Copies )----------------------------------- */
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
index 44a43e6..f4882c0 100644
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -108,6 +108,10 @@ final class PhabricatorEnv {
}
putenv('PATH='.$env_path);
+ // Write this back into $_ENV, too, so ExecFuture picks it up when creating
+ // subprocess environments.
+ $_ENV['PATH'] = $env_path;
+
PhabricatorEventEngine::initialize();
$translation = PhabricatorEnv::newObjectFromConfig('translation.provider');

Event Timeline