From 52990eca1eb3e2991edd78fe4a7b8dd023d4064b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 19 Jun 2013 13:00:13 +0200 Subject: [PATCH] Clear up github env everywhere it is used --- src/Composer/Package/Loader/RootPackageLoader.php | 4 ++++ src/Composer/Package/Locker.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index e47344cea..ca299a114 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -21,6 +21,7 @@ use Composer\Repository\RepositoryManager; use Composer\Repository\Vcs\HgDriver; use Composer\IO\NullIO; use Composer\Util\ProcessExecutor; +use Composer\Util\Git as GitUtil; /** * ArrayLoader built for the sole purpose of loading the root package @@ -182,6 +183,9 @@ class RootPackageLoader extends ArrayLoader private function guessGitVersion(array $config) { + $util = new GitUtil; + $util->cleanEnv(); + // try to fetch current version from git branch if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) { $branches = array(); diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 13b08e260..de5b1f9bd 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -21,6 +21,7 @@ use Composer\Repository\ArrayRepository; use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Loader\ArrayLoader; use Composer\Package\Version\VersionParser; +use Composer\Util\Git as GitUtil; /** * Reads/writes project lockfile (composer.lock). @@ -324,6 +325,9 @@ class Locker switch ($sourceType) { case 'git': + $util = new GitUtil; + $util->cleanEnv(); + if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) { $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC')); }