mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-18 15:27:17 +01:00
Support Git worktrees in generation of hash header
(cherry picked from commit 078ab7fe05dcf139b7f943937c602b2c9dbdc8e2)
This commit is contained in:
parent
568823dbcc
commit
29fda5543b
@ -119,6 +119,10 @@ def get_version_info(module_version_string="", silent=False):
|
|||||||
head = open_utf8(os.path.join(gitfolder, "HEAD"), "r").readline().strip()
|
head = open_utf8(os.path.join(gitfolder, "HEAD"), "r").readline().strip()
|
||||||
if head.startswith("ref: "):
|
if head.startswith("ref: "):
|
||||||
ref = head[5:]
|
ref = head[5:]
|
||||||
|
# If this directory is a Git worktree instead of a root clone.
|
||||||
|
parts = gitfolder.split("/")
|
||||||
|
if len(parts) > 2 and parts[-2] == "worktrees":
|
||||||
|
gitfolder = "/".join(parts[0:-2])
|
||||||
head = os.path.join(gitfolder, ref)
|
head = os.path.join(gitfolder, ref)
|
||||||
packedrefs = os.path.join(gitfolder, "packed-refs")
|
packedrefs = os.path.join(gitfolder, "packed-refs")
|
||||||
if os.path.isfile(head):
|
if os.path.isfile(head):
|
||||||
|
Loading…
Reference in New Issue
Block a user