Use verified SSH profiles from the primary checkout in linked worktrees

This commit is contained in:
2026-11-18 10:54:35 +01:00
parent 663e846415
commit 374b7e42d6
+14 -2
View File
@@ -16,8 +16,20 @@ from vm_access_check import load_config
from vm_mvp_acceptance import protected_json
def credentials_directory():
local = ROOT / "credentials"
if local.exists() or local.is_symlink():
return local
# Linked worktrees share the original checkout's already verified profiles.
common = subprocess.check_output(
["git", "-C", str(ROOT), "rev-parse", "--path-format=absolute", "--git-common-dir"],
text=True,
).strip()
return Path(common).parent / "credentials"
def ssh_prefix(target):
credentials = ROOT / "credentials"
credentials = credentials_directory()
config = load_config(credentials / ("linux-vm.conf" if target == "linux" else "server.conf"))
host = config["username"] + "@" + config["address"]
key = str(Path(config["ssh_key_path"]).expanduser())
@@ -150,7 +162,7 @@ def main():
if (not path.is_file() or not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.-]{0,126}", name)
or name.endswith(".") or PureWindowsPath(name).is_reserved()):
parser.error("Reguläre Datei mit portablem Artefaktnamen erwartet")
if path.resolve().is_relative_to(ROOT / "credentials"):
if path.resolve().is_relative_to(credentials_directory()):
parser.error("Zugangsprofile sind keine Entwicklungsartefakte")
prefix = None if args.plan else ssh_prefix(args.target)
for path in args.files: