Skip to content

Fix gitignore pathspec checks to resolve paths against repo root#556

Merged
dwash96 merged 1 commit into
cecli-dev:v0.100.5from
Digital-Defiance:pr/gitignore-path-resolve
Jun 5, 2026
Merged

Fix gitignore pathspec checks to resolve paths against repo root#556
dwash96 merged 1 commit into
cecli-dev:v0.100.5from
Digital-Defiance:pr/gitignore-path-resolve

Conversation

@JessicaMulein
Copy link
Copy Markdown

@JessicaMulein JessicaMulein commented Jun 4, 2026

Summary

  • Add GitRepo._resolve_path_in_repo() so relative paths are resolved under self.root, not process cwd.
  • Use it in _is_gitignored_by_pathspec() when walking .gitignore rules.

Problem

_is_gitignored_by_pathspec called Path(path).resolve() on relative paths. That resolves against the caller’s working directory, not the git repo root. In multi-repo / superproject setups (session cwd at a parent repo, GitRepo rooted at a submodule), tracked files could be falsely reported as gitignored and /add would reject them.

Example: cecli submodule with whitelist .gitignore (* + !/cecli/**), cwd at superproject root, path cecli/helpers/responses.py mis-resolved and matched *.

Test plan

  • Unit: relative path under repo root resolves correctly regardless of process cwd
  • Manual: superproject dogfood — /add cecli/cecli/helpers/responses.py succeeds when cwd is parent repo root

Relative paths passed to _is_gitignored_by_pathspec used Path.resolve()
against process cwd, so multi-repo / superproject sessions could falsely
mark tracked files as gitignored and reject /add.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JessicaMulein JessicaMulein force-pushed the pr/gitignore-path-resolve branch from b612d5c to fcf8876 Compare June 4, 2026 21:42
@dwash96 dwash96 changed the base branch from main to v0.100.5 June 5, 2026 04:54
@dwash96 dwash96 merged commit 2c5b49a into cecli-dev:v0.100.5 Jun 5, 2026
12 checks passed
@dwash96 dwash96 mentioned this pull request Jun 5, 2026
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.

2 participants