Subject: [PATCH 17/17] git p4 clone --bare: need to be explicit about the gitdir

From: "Johannes Schindelin via GitGitGadget" <[email-masked]>
Date: Thu, 02 Apr 2026 14:33:23 +0000

From: Johannes Schindelin <[email-masked]>

When `safe.bareRepository` will change to be safe by default, bare
repositories won't be discovered by default anymore. To prepare for
this, `git p4` must be explicit about the gitdir when cloning into a
bare repository, and no longer rely on that implicit discovery.

Signed-off-by: Johannes Schindelin <[email-masked]>
---
 git-p4.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-p4.py b/git-p4.py
index c0ca7becaf..dd38dbca22 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -4360,6 +4360,7 @@ class P4Clone(P4Sync):
         init_cmd = ["git", "init"]
         if self.cloneBare:
             init_cmd.append("--bare")
+            os.environ["GIT_DIR"] = os.getcwd()
         retcode = subprocess.call(init_cmd)
         if retcode:
             raise subprocess.CalledProcessError(retcode, init_cmd)
-- 
gitgitgadget