Skip to content

fix(worktrees): reject corrupted bare checkout configs - #16

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

mateodelnorte merged 1 commit into
mainfrom
tasks/harden-git-hook-repository-environment

Conversation

@mateodelnorte

Copy link
Copy Markdown
Contributor

Summary

  • route worktree Git subprocesses through a command builder that strips repository-local Git environment variables
  • detect core.bare=true on ordinary checkout paths before worktree operations proceed
  • return a scoped repair command while continuing to allow legitimate bare repositories
  • cover environment clearing, corruption detection, legitimate bare repos, and repair-command quoting

Root cause

Git subprocesses inherited repository-local variables from the caller, so a nested operation could bind to the wrong repository config. The worktree path then lacked a guard against the resulting contradictory state: a checkout with core.bare=true.

Testing

  • cargo test -p meta_git_lib --lib (151 passed)
  • cargo clippy -p meta_git_lib --all-targets --no-deps -- -D warnings
  • git diff --check origin/main...HEAD

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: 59 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: f8db562e-5abb-47e0-98bf-44f9a80c06e4

📥 Commits

Reviewing files that changed from the base of the PR and between cf435ac and f209067.

📒 Files selected for processing (1)
  • src/worktree/git_ops.rs

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.

@mateodelnorte
mateodelnorte merged commit 960c6fc into main Aug 2, 2026
11 of 12 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