Run test suite from temporary test directory.
A couple of git tests were passing when the test suite was run from a git checkout and failing when not. This was due to an underlying errorneous assumption. This commit fixes that assumption by making a new git checkout, and also changes to the temporary directory setup for the test at the start to hopefully prevent other tests from passing when they shouldn't. (cherry picked from commit 5a01d0d1)