1
0
Fork 0

Clean up git env vars consistently

pull/1969/merge
Jordi Boggiano 2013-06-19 11:44:16 +02:00
parent 48b6e8cd21
commit 81b2b84112
2 changed files with 11 additions and 3 deletions

View File

@ -77,6 +77,7 @@ class GitDownloader extends VcsDownloader
*/
public function getLocalChanges($path)
{
$this->cleanEnv();
$path = $this->normalizePath($path);
if (!is_dir($path.'/.git')) {
return;
@ -95,6 +96,7 @@ class GitDownloader extends VcsDownloader
*/
protected function cleanChanges($path, $update)
{
$this->cleanEnv();
$path = $this->normalizePath($path);
if (!$changes = $this->getLocalChanges($path)) {
return;

View File

@ -26,10 +26,16 @@ class Git
}
// added in git 1.7.1, prevents prompting the user for username/password
putenv('GIT_ASKPASS=echo');
if (getenv('GIT_ASKPASS') !== 'echo') {
putenv('GIT_ASKPASS=echo');
}
// clean up rogue git env vars in case this is running in a git hook
putenv('GIT_DIR');
putenv('GIT_WORK_TREE');
if (getenv('GIT_DIR')) {
putenv('GIT_DIR');
}
if (getenv('GIT_WORK_TREE')) {
putenv('GIT_WORK_TREE');
}
}
}