# SPDX-FileCopyrightText: Defame1297 and contributors # SPDX-License-Identifier: GPL-3.0-or-later """The environment for a test's git fixture: no caller GIT_* and no user or system config.""" import os def isolated(**extra): """A copy of os.environ for git: a hook exports GIT_DIR, which would point it at the real repo.""" env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")} env.update(GIT_CONFIG_GLOBAL="/dev/null", GIT_CONFIG_NOSYSTEM="1", **extra) return env