schacon/ruby-git — pull request #160 by thisissmithj (2014-07-16 04:58:44+00:00)
Title: pass env variables to popen, rather than setting them globally

The Git library sets global state when running instance methods, which is suboptimal and unexpected. The issue is important, as it affects not only other instantiated Git objects, but also affects simple `git blah` commands. That makes debugging very difficult.

This is a better solution to the global environment variables issue than the other pull request that I saw. If you set then unset global variables, you're going to have issues in multi-threaded programs (I had issues when using celluloid worker threads). However, if you put the env data into a hash and pass it to each popen call, then there is no requirement for global state at all.

Also note that all of the methods that I changed are private.