Skip to content

Commit 03705e0

Browse files
committed
Fix: Skip direnv allow in worktrees with mismatched directory names
The setup script now checks if the directory basename matches the expected repo name before running 'direnv allow'. This prevents confusing warning messages on every shell prompt when using worktrees with different names, while still allowing the script to successfully bootstrap the environment.
1 parent 1a80630 commit 03705e0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/setup-worktree.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ echo "Bootstrapping sentry-protos worktree at ${repo_root}"
1515
devenv sync
1616

1717
if command -v direnv >/dev/null 2>&1 && [ -f .envrc ]; then
18-
direnv allow "${repo_root}" >/dev/null 2>&1 || true
18+
expected_repo_name="$(awk -F'[][.]' '/^\[venv\./{print $3; exit}' devenv/config.ini 2>/dev/null)"
19+
if [ -z "$expected_repo_name" ] || [ "$(basename "${repo_root}")" = "$expected_repo_name" ]; then
20+
direnv allow "${repo_root}" >/dev/null 2>&1 || true
21+
fi
1922
fi
2023

2124
echo "Worktree setup complete."

0 commit comments

Comments
 (0)