Skip to content

fix(hooks): isolate Git-local test environment - #98

Merged
mateodelnorte merged 2 commits into
mainfrom
tasks/harden-git-hook-repository-environment
Aug 2, 2026
Merged

mateodelnorte merged 2 commits into
mainfrom
tasks/harden-git-hook-repository-environment

Conversation

@mateodelnorte

Copy link
Copy Markdown
Contributor

Summary

  • clear repository-local Git variables in the shared pre-push hook before invoking Cargo
  • centralize sanitized Git test setup and use explicit bare fixture repositories
  • add hook and worktree regressions that verify caller config cannot be mutated

Root cause

The shared hook and BATS fixtures inherited GIT_DIR, GIT_WORK_TREE, and related repository-local variables from the invoking checkout. Fixture Git commands could consequently target the caller's shared config and flip core.bare in a normal worktree repository.

Testing

  • cargo test --workspace
  • cargo clippy -p meta_git_lib --all-targets --no-deps -- -D warnings
  • full BATS suite: 324 passed; the existing empty-PATH plugin test remains environment-dependent because Homebrew-installed meta-git and meta-project are discoverable

Tracking

  • [[tasks/harden-git-hook-repository-environment]]
  • [[incidents/git-core-bare-corruption-in-worktree-repositories]]

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6cfbb398-2221-488c-8cb2-a070f2f68194

📥 Commits

Reviewing files that changed from the base of the PR and between 4d8adcc and ff7fb00.

📒 Files selected for processing (13)
  • .githooks/pre-push
  • tests/context.bats
  • tests/exec.bats
  • tests/git.bats
  • tests/help.bats
  • tests/helpers/git_environment.bash
  • tests/hooks.bats
  • tests/init.bats
  • tests/plugin_install.bats
  • tests/project_list.bats
  • tests/worktree.bats
  • tests/worktree_cloud.bats
  • tests/worktree_edge_cases.bats

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

@mateodelnorte

Copy link
Copy Markdown
Contributor Author

Coordinated change set:

These PRs jointly isolate Git-local hook/test environments and add the worktree corruption guard.

[[tasks/harden-git-hook-repository-environment]]
@mateodelnorte
mateodelnorte merged commit ae5818b into main Aug 2, 2026
9 checks passed
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.

1 participant