diff --git a/scripts/carry.py b/scripts/carry.py index abdaab2a..2fda08e8 100755 --- a/scripts/carry.py +++ b/scripts/carry.py @@ -340,8 +340,6 @@ def verify_target( branch = git(target, "branch", "--show-current") if not branch or branch in {"main", "develop"}: raise CarryError("target must be an isolated feature-branch worktree") - if not (target / ".git").is_file(): - raise CarryError("target must be a linked worktree, not the primary checkout") git(target, "fetch", "origin", "develop") if not git_is_ancestor(target, "origin/develop", "HEAD"): raise CarryError("target branch must contain the current origin/develop head") diff --git a/scripts/tests/test_carry.py b/scripts/tests/test_carry.py index 97a04b79..d21bcdfd 100755 --- a/scripts/tests/test_carry.py +++ b/scripts/tests/test_carry.py @@ -273,6 +273,7 @@ def test_target_identity_and_unrelated_dirty_state(self) -> None: root = pathlib.Path(temp) remote = root / "remote.git" clone = root / "clone" + standalone = root / "standalone" worktree = root / "worktree" subprocess.run(["git", "init", "--bare", remote], check=True, capture_output=True) subprocess.run(["git", "clone", remote, clone], check=True, capture_output=True) @@ -296,6 +297,18 @@ def test_target_identity_and_unrelated_dirty_state(self) -> None: ) owned = worktree / "owned" + subprocess.run( + ["git", "clone", "--branch", "develop", remote, standalone], + check=True, + capture_output=True, + ) + subprocess.run( + ["git", "-C", standalone, "switch", "-c", "feature/standalone"], + check=True, + capture_output=True, + ) + carry.verify_target(standalone, {"url": str(remote)}, [standalone / "owned"]) + with self.assertRaisesRegex(carry.CarryError, "origin does not match"): carry.verify_target(worktree, {"url": str(root / "other.git")}, [owned])