Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions scripts/carry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 13 additions & 0 deletions scripts/tests/test_carry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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])

Expand Down