dmtrKovalenko / dmtrKovalenko/fff

[Suggestion]: index files inside linked git worktrees that live under repo root (like .worktrees/)

Open
#608 3 comments 1 reaction 0 assignees View on GitHub
enhancement triaged
Dominant language
Rust
Stars
10.7k
Forks
446
Avg merge
1d 21h
Merged PRs (30d)
39

Description

### Which fff frontend(s)?

MCP server (fff-mcp)

### What problem are you trying to solve?

## In short

I use `fff-mcp` daily and I am very thankful for it — it became part of my hands. But there is one case where it cannot help me, and I think it is worth fixing.

When I start `fff-mcp` at the root of repository, it does not see files that live in **linked git worktrees nested under this root**. Typical layout in our team is `/.worktrees//`. We keep `.worktrees/` in `.gitignore` on purpose, so that `git status` stays clean. And here is the whole problem: fff respects `.gitignore` and `.git/info/exclude` honestly, so these files become invisible.

## My environment

- Tool: `fff-mcp` (the MCP build of fff), one positional argument `[PATH]`
- Host: Claude Code. It starts MCP server once per session, and sets working directory of server equal to directory from where editor was launched.
- OS: macOS (darwin)

## What happens now

1. `fff-mcp` decides its scan root through `Repository::discover(&base_path)` → `repo.workdir()` (you can see it in `crates/fff-mcp/src/main.rs`). When I am already inside a worktree, this resolves to that worktree workdir, and then everything works perfectly — so **per-worktree start is not a problem**.
2. But when I start from the main checkout, the root becomes the main workdir. Nested worktrees under `.worktrees/` are thrown away, because they are written in `.gitignore` (and frequently in `.git/info/exclude` too), and fff obeys both of them.
3. In CLI there is no `--no-ignore`, and in `FffCreateOptions` (`crates/fff-c/include/fff.h`) there is no field to switch ignore off. `PATH` is single — so no second root either.

So the conclusion is simple and a little sad: a session that started at the main checkout will **never** see the worktree files, and one instance cannot serve the main checkout and the worktrees together.

## Why this is important for me (and possibly not only for me)

Worktrees nested under the repo (`/.worktrees//`) are not exotic —
for teams that hold many branches checked out at the same time. We put `.worktrees/` into `.gitignore` exactly to keep `git status` quiet, and exactly this gesture is what hides them from fff. Very often I open one session at the root and then walk into a worktree in the middle of work — and from this moment fff, nailed to the main root since launch, becomes blind to the very files I am editing. It is a pity, because the engine itself is fast and good.

### Proposed solution

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in crates/fff-mcp/src/main.rs at Repository::discover(&base_path) and follow how repo.workdir() establishes the scan root and how ignored paths are handled. Review crates/fff-c/include/fff.h for the available FffCreateOptions, then verify that a session started at the main checkout can index files in nested linked worktrees while preserving normal ignore behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.