Skip to content

Commit

Permalink
Unset the HOME env before calling git binary
Browse files Browse the repository at this point in the history
If we do no unset the env, git will use a potential
.gitconfig which can alter results
  • Loading branch information
lyrixx committed Jan 20, 2013
1 parent b20fb95 commit a3f390e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Gitonomy/Git/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ protected function getProcess($command, $args = array())

$builder = new ProcessBuilder(array_merge($base, $args));

$builder->inheritEnvironmentVariables(false);

This comment has been minimized.

Copy link
@hason

hason Jan 28, 2013

Contributor

You removed all environment variables including PATH (-bash: git: command not found). Please remove only needed variables.

This comment has been minimized.

Copy link
@alexandresalome

alexandresalome Jan 28, 2013

Member

it's also a consideration about security, since you can change the way git behaves with environment variable.

  • GIT_COMMITTER_NAME
  • GIT_COMMITTER_EMAIL
  • GIT_AUTHOR_NAME
  • GIT_AUTHOR_EMAIL

This modification doesn't break things here (using linux). Are you using Windows?

This comment has been minimized.

Copy link
@hason

hason Jan 28, 2013

Contributor

Yes, I'm on windows.

This comment has been minimized.

Copy link
@alexandresalome

alexandresalome Jan 28, 2013

Member

created ticket #30

This comment has been minimized.

Copy link
@bestform

bestform Oct 21, 2014

this kills the library on osx. it cannot read the global settings resulting in exceptions when trying to run actions that need the name and email (like commit).


return $builder->getProcess();
}
}

0 comments on commit a3f390e

Please sign in to comment.