Repository navigation
fix(gix-dir): ignored entries don't make a collapsed directory of empty ones untracked - #3255
Conversation
…ty ones untracked A directory holding only ignored files and empty directories has no untracked file, and `git status` doesn't show it. The untracked collapse kept the `EmptyDirectory` property (GitoxideLabs#2490) only when every collapsed entry was an empty directory, so an ignored file beside them made the directory show as untracked: `d/` with `d/a.o` (ignored) and `d/empty/`, or an Xcode workspace with an ignored `userdata/` beside `shared/empty/`. Now only the untracked entries decide. Found by argus, a multi-repository status tool built on `gix`, which works around it by asking for untracked files individually and collapsing them itself, walking every file of large untracked directories. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee2870c9f0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".
| .filter(|entry| entry.status == entry::Status::Untracked) | ||
| .all(|entry| entry.property == Some(entry::Property::EmptyDirectory))) |
There was a problem hiding this comment.
Keep requested ignored entries observable
When ignored output is enabled while untracked entries are collapsed (the normal gix status --ignored combination), a directory like file-and-empty has an ignored file plus an untracked EmptyDirectory; this filter removes the file from the check, marks the parent empty, drains both children with the default emit_collapsed = None, and emit_entry() suppresses the parent because empty-directory emission is off. The CLI help says --ignored will “show ignored files and directories” (src/plumbing/options/mod.rs:593-595), but this case now yields no entry, so preserve the ignored side whenever it was requested.
Useful? React with 👍 / 👎.
| entries, | ||
| &[ | ||
| entry("dir-and-empty", Untracked, Directory).with_property(EmptyDirectory), | ||
| entry("file-and-empty", Untracked, Directory).with_property(EmptyDirectory), |
There was a problem hiding this comment.
Update the empty-directory contract
The newly added file-and-empty case deliberately returns Property::EmptyDirectory even though the fixture creates file-and-empty/a.o; however, the public enum docs still define this property as an empty directory (gix-dir/src/entry.rs:10-11), and the option docs say no nested directory may contain a file (gix-dir/src/walk/mod.rs:182-185, mirrored at gix/src/dirwalk/options.rs:130-132). Consumers asking to emit empty directories now receive metadata that contradicts the contract, so model “no reportable untracked content” separately or update these directly related public docs with the new ignored-file semantics.
AGENTS.md reference: AGENTS.md:L263-L263
Useful? React with 👍 / 👎.
Opened by Claude, an AI agent (Claude Opus 5.5), through the account holder's GitHub account at their request. This description is Claude's own.
A directory holding only ignored files and empty directories has no untracked file, and
git statusdoesn't show it. Withemit_untracked: CollapseDirectoryand empty directories not emitted (asgix statusdoes),gix-dirreports it as untracked:The same happens with an ignored directory beside an empty one (an Xcode workspace with an ignored
userdata/besideshared/empty/, which is where it was found), and at any depth.Cause: the untracked collapse keeps the
EmptyDirectoryproperty (#2490) only when every held entry is an empty directory. When untracked directories collapse, ignored entries are held too, so one beside the empty directories drops the property and the directory is emitted as untracked.Fix: only the untracked held entries decide. The collapse itself is unchanged (it already allowed ignored entries among untracked ones), as is the deletion walk and the ignored collapse, which the existing condition excludes.
Tests: a new
ignored-and-emptyfixture inmany.shwith an ignored file beside an empty directory, an ignored directory beside one, the nested Xcode case, and a control with an untracked file. Without emitting empty directories only the control shows; with them, the other three show withEmptyDirectory. The test fails before the fix.gix-dirandgix-statustests pass, as dogix'sstatusanddirwalktests. Reproduced ongix0.90.0 and onmainat 2bcb31d.Motivation: argus, a multi-repository status tool built on
gix, works around this by asking for untracked files individually and collapsing them itself, so it walks every file of large untracked directories wheregit statusstops at the directory.