Skip to content

fix: do not run repository hooks when creating sub-PR worktrees - #166

Closed
vitali87 wants to merge 366 commits into
fix/add-ignored-paths-with-forcefrom
fix/worktree-add-without-hooks
Closed

vitali87 wants to merge 366 commits into
fix/add-ignored-paths-with-forcefrom
fix/worktree-add-without-hooks

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Summary

Follow-up to #161: git worktree add fires the repository's post-checkout hook inside the throwaway sub-PR worktree. A hook that needs the project toolchain (husky / lint-staged installers) fails there, aborting add_worktree with the hook's error and leaving the directory and branch behind.

add_worktree now runs git -c core.hooksPath=<empty temp dir> worktree add …, so no hook runs for that one command — the setting applies to the checkout git performs inside the new worktree too (verified with a marker-file hook). Hooks configured via core.hooksPath are bypassed the same way.

Stacked on #162 (stack #163 = #161→#162→this).

Test plan

  • real-git: a failing .git/hooks/post-checkout and a failing hook under core.hooksPath no longer block worktree creation; argv assertion updated — all three fail on the base
  • 451 tests pass, ruff clean
  • Local review: 5/5

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2863f25a-270c-4acc-9d7b-558fd5e19989

📥 Commits

Reviewing files that changed from the base of the PR and between 6ee6e31 and aaccf31.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (64)
  • .github/workflows/split-score.yml
  • README.md
  • action.yml
  • pr_split/cli.py
  • pr_split/config.py
  • pr_split/constants.py
  • pr_split/diff_ops/new_file_split.py
  • pr_split/diff_ops/parser.py
  • pr_split/diff_ops/reconstructor.py
  • pr_split/exceptions.py
  • pr_split/git_ops/__init__.py
  • pr_split/git_ops/branches.py
  • pr_split/git_ops/prs.py
  • pr_split/graph.py
  • pr_split/logs.py
  • pr_split/per_group.py
  • pr_split/plan_store.py
  • pr_split/planner/__init__.py
  • pr_split/planner/chunker.py
  • pr_split/planner/client.py
  • pr_split/planner/new_file_pieces.py
  • pr_split/planner/partitioning.py
  • pr_split/planner/repair.py
  • pr_split/planner/scoring.py
  • pr_split/planner/symbols.py
  • pr_split/planner/validator.py
  • pr_split/recover.py
  • pr_split/restack.py
  • pr_split/schemas.py
  • pr_split/stack_move.py
  • pyproject.toml
  • scripts/score_pr.py
  • tests/conftest.py
  • tests/network_guards.py
  • tests/test_chunker.py
  • tests/test_cli_coverage.py
  • tests/test_cli_helpers.py
  • tests/test_cli_new_features.py
  • tests/test_client.py
  • tests/test_config.py
  • tests/test_default_strategy.py
  • tests/test_description_refresh.py
  • tests/test_diff_base.py
  • tests/test_diff_parser_extended.py
  • tests/test_git_branches.py
  • tests/test_git_prs.py
  • tests/test_git_prs_coverage.py
  • tests/test_graph.py
  • tests/test_local_provider.py
  • tests/test_new_file_split.py
  • tests/test_partitioning.py
  • tests/test_per_group.py
  • tests/test_plan_store.py
  • tests/test_reconstructor.py
  • tests/test_recover.py
  • tests/test_repair.py
  • tests/test_restack.py
  • tests/test_schemas.py
  • tests/test_score_pr.py
  • tests/test_score_pr_events.py
  • tests/test_scoring.py
  • tests/test_stack_move.py
  • tests/test_symbols.py
  • tests/test_validator.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

fix: floor the auto-derived min_loc at 1
fix: reject diffs containing binary files instead of silently dropping them
fix: keep one assignment per file when merging chunk groups
fix: show UNKNOWN in status when a PR's live state cannot be fetched
fix: reject a remote-tracking --base up front instead of failing at PR creation
…hunks

fix: carry every ancestor's hunks into stacked descendants
fix: make branch cleanup reliable on failure and in clean
fix: report fork-PR resolution errors instead of a traceback
chore: remove dead checkout-based branch helpers
claude and others added 27 commits September 27, 2026 06:12
…dopt

gh pr list --head also returns fork PRs and heads that merely start with
the branch name, so find_open_pr now keeps only an exact, same-repository
head. A failed link or lookup saves nothing, so adopt can be re-run; the
error now says so, since the stack may already be partly registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Keep the quoted-header normaliser and main's split_new_files_over
parameter on parse_diff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
adopt records the user's own branches and PRs in the plan's git state, so
clean (and a re-split's cleanup) would close those PRs and delete the
branches locally and remotely. Records now carry an adopted flag, set by
adopt; cleanup counts adopted ones as done without touching them, so the
plan is forgotten and the user's work is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
feat: adopt already-built branches as a native stack
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
…nder its top branch

adopt (from main) checked for an existing plan and saved one without
selecting a branch, so with plans for other branches it hit the ambiguous
plan error or refused over another branch's state. It now selects the
stack's top branch first, as split does with its dev branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Keep both sides' tests; the merged-cleanup test patches plan_path, which
cleanup now uses to find the plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
#146 (the base of this branch) is already in main, so the merge keeps
main's code and adds only #168's change: an Anthropic token-count
failure is an LLMError, and a rejected key names ANTHROPIC_API_KEY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
feat: retarget a split whose base branch has merged
feat: group units that share names in the graph backend and name every group
feat: one plan per dev branch, plan dir out of git, atomic saves, and a plan-aware clean check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
Since execute lays out any plan with dependency edges along its DAG,
stacked or not, an unstacked child also sits on its parent's branch;
rebuilding the parent on resume would rewrite the base under the child's
open PR. Keep recorded ancestors whenever the plan has dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
fix: resume execute past groups whose PRs already exist, and retry transient push errors
fix: report an Anthropic token-count failure as an LLM error, naming a rejected key
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
A fixed path under the shared temp dir could be created first by another
local user, who could then plant hooks that run during worktree add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w

Copy link
Copy Markdown
Owner Author

This change is already in main: it landed via the merge train #243, which includes this PR's head commit. GitHub can't mark a stacked PR merged when it lands that way, so I'm closing it as done.


Generated by Claude Code

@vitali87 vitali87 closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants