Skip to content

fix: handle tracked paths in exclude queries#2735

Merged
Sebastian Thiel (Byron) merged 5 commits into
mainfrom
better-exclude-handling
Jul 22, 2026
Merged

fix: handle tracked paths in exclude queries#2735
Sebastian Thiel (Byron) merged 5 commits into
mainfrom
better-exclude-handling

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Jul 22, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Fixes #2562

Summary

  • Suppress ignore matches for tracked files and directories represented in the index.
  • Keep reporting untracked ignored descendants and preserve gix pathspec expansion semantics.
  • Normalize stdin paths from repository subdirectories before index lookup.

Git baseline

Compared with git check-ignore and Git sources builtin/check-ignore.c and dir.c at a23bace963d508bd96983cc637131392d3face18.

Validation

  • cargo fmt --all --check
  • cargo test -p gitoxide-core --lib --quiet
  • just journey-tests-small
  • Codex commit review: clear

This is the smaller command-scoped replacement for draft #2564; that draft is left untouched.

Sebastian Thiel (Byron) and others added 3 commits July 22, 2026 13:12
This makes isolated discovery easier, at the cost of less control
compared to its `gix::ThreadSafeRepository` counterpart.

Co-authored-by: GPT 5.6 <codex@openai.com>
While `normalize()` is optimised for keeping the look of paths the same,
the new function truly wants to normalize.

Co-authored-by: GPT 5.6 <codex@openai.com>
This way, one won't have to use the `Pattern + normalize` workaround anymore.

Co-authored-by: GPT 5.6 <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8e72e2dac

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread gitoxide-core/src/repository/exclude.rs
Sebastian Thiel (Byron) and others added 2 commits July 22, 2026 14:25
<!-- agent -->

`gix exclude query` reported ignore matches for tracked files and directories
containing tracked entries, unlike `git check-ignore`. Positional arguments were
also interpreted as pathspecs while stdin supplied paths.

Treat positional and stdin input uniformly as paths, normalize them relative
to the repository, and suppress ignore matches for indexed files or directories
containing indexed entries. This changes positional arguments from pathspecs
to paths.

Add journey coverage for tracked and untracked paths below ignored directories,
stdin from a nested working directory, ignore-pattern display, and positional
output order.

Co-authored-by: GPT 5.6 <codex@openai.com>
Co-authored-by: GPT 5.6 <codex@openai.com>
@Byron
Sebastian Thiel (Byron) merged commit 02cb162 into main Jul 22, 2026
56 of 58 checks passed
@Byron
Sebastian Thiel (Byron) deleted the better-exclude-handling branch July 22, 2026 13:17
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.

Clarify handling of ignored directories that contain tracked files

1 participant