1
0
Fork 0

Clear up github env everywhere it is used

pull/1969/merge
Jordi Boggiano 2013-06-19 13:00:13 +02:00
parent 81b2b84112
commit 52990eca1e
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@ use Composer\Repository\RepositoryManager;
use Composer\Repository\Vcs\HgDriver; use Composer\Repository\Vcs\HgDriver;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Git as GitUtil;
/** /**
* ArrayLoader built for the sole purpose of loading the root package * ArrayLoader built for the sole purpose of loading the root package
@ -182,6 +183,9 @@ class RootPackageLoader extends ArrayLoader
private function guessGitVersion(array $config) private function guessGitVersion(array $config)
{ {
$util = new GitUtil;
$util->cleanEnv();
// try to fetch current version from git branch // try to fetch current version from git branch
if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) { if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) {
$branches = array(); $branches = array();

View File

@ -21,6 +21,7 @@ use Composer\Repository\ArrayRepository;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Util\Git as GitUtil;
/** /**
* Reads/writes project lockfile (composer.lock). * Reads/writes project lockfile (composer.lock).
@ -324,6 +325,9 @@ class Locker
switch ($sourceType) { switch ($sourceType) {
case 'git': 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)) { 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')); $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
} }