Fix GitClient.get_repository_info to not change the working directory.
Review Request #9886 — Created April 23, 2018 and submitted
One particularly annoying aspect of the GitClient is that it changes the
working directory after scanning. This has a variety of impacts, and
makes it hard to implement certain things like more advanced client
This change fixes it up so that we can pass in a cwd argument to
Popen. Instead of changing the working directory for the entire
process, we just do so for the subprocesses that get executed.
- Ran unit tests on Python 2.7 and 3.6.
- Did a variety of operations with a git repository.
What are your thoughts on having this always strip (or strip by default, with an argument for changing that, or opting into it)? We have a lot of call sites that strip, and I think most of the rest could strip without harm.
Doesn't have to be this change, just something I noticed while going through this.