git p4 clone --bare: need to be explicit about the gitdir

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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin
2026-04-02 14:33:23 +00:00
committed by Junio C Hamano
parent bf92209ddc
commit 347da97f3e

View File

@@ -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)