Skip to content

Commit 73758ff

Browse files
nicksenapclaude
andcommitted
Fix setup hooks reading .grove.toml from worktree instead of source repo
The setup config was read from the worktree path, which may not have .grove.toml if the file isn't committed. Now reads from the source repo (consistent with how base_branch is read) while still running commands in the worktree. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7fa5475 commit 73758ff

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/grove/workspace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def create_workspace(
9494

9595
# --- Run per-repo setup hooks ---
9696
for repo_wt in created:
97-
_run_setup(repo_wt.repo_name, repo_wt.worktree_path)
97+
_run_setup(repo_wt.repo_name, repo_wt.source_repo, repo_wt.worktree_path)
9898

9999
workspace = Workspace(
100100
name=name,
@@ -106,9 +106,9 @@ def create_workspace(
106106
return workspace
107107

108108

109-
def _run_setup(repo_name: str, worktree_path: Path) -> None:
110-
"""Run setup commands from ``.grove.toml`` in the worktree."""
111-
cfg = git.read_grove_config(worktree_path)
109+
def _run_setup(repo_name: str, source_repo: Path, worktree_path: Path) -> None:
110+
"""Run setup commands from ``.grove.toml`` (read from source repo, run in worktree)."""
111+
cfg = git.read_grove_config(source_repo)
112112
setup = cfg.get("setup")
113113
if not setup:
114114
return

tests/test_workspace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ def test_runs_setup_command(self, tmp_grove):
135135
patch(
136136
"grove.workspace.git.read_grove_config",
137137
return_value={"setup": "pnpm install"},
138-
),
138+
) as mock_cfg,
139139
):
140140
ws = workspace.create_workspace("test", {"svc-api": repo_path}, "feat/x", cfg)
141141
assert ws is not None
142+
# Config should be read from the source repo, not the worktree
143+
mock_cfg.assert_called_once_with(repo_path)
142144
mock_sub.assert_called_once_with(
143145
"pnpm install",
144146
cwd=ws.path / "svc-api",

0 commit comments

Comments
 (0)