From 8f679dbba0bf58fbc3cb0bab800a0d6aae31c936 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Wed, 25 Nov 2026 22:23:01 -0700 Subject: [PATCH] Git: a repository named by the caller's environment (GIT_DIR and friends) no longer decides which project a folder is A git hook sets GIT_DIR, so sisi's git calls resolved every checkout to that outer repository; the tripwire test failed with inherited GIT_DIR. Co-Authored-By: Claude Haiku 5.5 --- sisi/store.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sisi/store.py b/sisi/store.py index 2bd586f..7c4d71a 100644 --- a/sisi/store.py +++ b/sisi/store.py @@ -87,8 +87,10 @@ def append(path, line, once=False): def git(args, cwd, timeout=15): + # A repository named by the caller's environment (a git hook sets GIT_DIR) must not decide which project this folder is. + env = {k: v for k, v in os.environ.items() if k not in ("GIT_DIR", "GIT_WORK_TREE", "GIT_INDEX_FILE", "GIT_COMMON_DIR")} try: - r = subprocess.run(["git"] + args, cwd=cwd, capture_output=True, text=True, timeout=timeout) + r = subprocess.run(["git"] + args, cwd=cwd, capture_output=True, text=True, timeout=timeout, env=env) return r.returncode, r.stdout except (OSError, subprocess.SubprocessError): return 1, ""