Clean up git env vars consistently
parent
48b6e8cd21
commit
81b2b84112
|
@ -77,6 +77,7 @@ class GitDownloader extends VcsDownloader
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges($path)
|
public function getLocalChanges($path)
|
||||||
{
|
{
|
||||||
|
$this->cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (!is_dir($path.'/.git')) {
|
if (!is_dir($path.'/.git')) {
|
||||||
return;
|
return;
|
||||||
|
@ -95,6 +96,7 @@ class GitDownloader extends VcsDownloader
|
||||||
*/
|
*/
|
||||||
protected function cleanChanges($path, $update)
|
protected function cleanChanges($path, $update)
|
||||||
{
|
{
|
||||||
|
$this->cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (!$changes = $this->getLocalChanges($path)) {
|
if (!$changes = $this->getLocalChanges($path)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,10 +26,16 @@ class Git
|
||||||
}
|
}
|
||||||
|
|
||||||
// added in git 1.7.1, prevents prompting the user for username/password
|
// 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
|
// clean up rogue git env vars in case this is running in a git hook
|
||||||
putenv('GIT_DIR');
|
if (getenv('GIT_DIR')) {
|
||||||
putenv('GIT_WORK_TREE');
|
putenv('GIT_DIR');
|
||||||
|
}
|
||||||
|
if (getenv('GIT_WORK_TREE')) {
|
||||||
|
putenv('GIT_WORK_TREE');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue