Fix temporary folder removal at the end of a test run

Change-Id: I1dcb2447a6dd54e8ec9b84805e957244181547b5
Ensure the testing git repo has the right shape

Add ignore files in the refs/heads and refs/tags folders to ensure
that these folders are re-created in a fresh working copy.

Change-Id: I1c7cc20b3ef17ad87eb52367430d0d3b507b4b88