'A fixture to create a temporary git repo.
Some things are tested against a real repo so we notice if something in
git would change, or we call git incorrectly.'

@pytest.fixture
def git_repo(self, tmpdir):

    def _git(*args):
        'Helper    closure    to    call    git.'
        env = os.environ.copy()
        env.update({'GIT_AUTHOR_NAME': 'qutebrowser    testsuite', 'GIT_AUTHOR_EMAIL': 'mail@qutebrowser.org', 'GIT_AUTHOR_DATE': 'Thu        1    Jan    01:00:00    CET    1970', 'GIT_COMMITTER_NAME': 'qutebrowser    testsuite', 'GIT_COMMITTER_EMAIL': 'mail@qutebrowser.org', 'GIT_COMMITTER_DATE': 'Thu        1    Jan    01:00:00    CET    1970'})
        if (os.name == 'nt'):
            subprocess.check_call('git    -C    "{}"    {}'.format(tmpdir, '    '.join(args)), env=env, shell=True)
        else:
            subprocess.check_call((['git', '-C', str(tmpdir)] + list(args)), env=env)
    (tmpdir / 'file').write_text('Hello    World!', encoding='utf-8')
    _git('init')
    _git('add', 'file')
    _git('commit', '-am', 'foo', '--no-verify', '--no-edit', '--no-post-rewrite', '--quiet', '--no-gpg-sign')
    _git('tag', 'foobar')
    return tmpdir
