worktree: Fix global gitignore on ancestors (#61689)

# Objective

Fixes #61687

Prior to #60772, an `abs_path` outside the `repo_root` would cause a
panic. That PR changed it to return the `abs_path` itself, preventing
the panic, but allowing all parents of `repo_root` to be subject to the
global ignore.

This is not what git itself does.

## Solution

- This change returns `false` when the `abs_path` is outside the
`root_repo`, preventing the panic but also not returning the `abs_path`

## Testing

- One in-memory test
- Manual test by building Zed and confirming the project pane changes
(pictured below)

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

### Before, with the bug

<img width="1430" height="814" alt="Screenshot 2026-07-26 at 11 44
11 AM"
src="https://github.com/user-attachments/assets/66e3bb95-4f45-4fd9-a1e4-e7f253f092eb"
/>

### After the fix

<img width="1568" height="1042" alt="Screenshot 2026-07-26 at 12 34
58 PM"
src="https://github.com/user-attachments/assets/588eb01d-830a-4c22-93c0-667742de90b6"
/>

Release Notes:

- Fixed the project panel's global gitignore incorrectly matching parent
directories of a repository

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
c2db0f1a97Dylan Arbour committed on 7/29/2026, 10:22:08 AM· committed by GitHubparent97961c2
2 files changedLine totals unavailable