Skip to content

Fix git status parser to handle paths with spaces and renames#272

Merged
acarl005 merged 1 commit into
warpdotdev:mainfrom
nickeddy:fix-command-signatures-271
Jul 13, 2026
Merged

Fix git status parser to handle paths with spaces and renames#272
acarl005 merged 1 commit into
warpdotdev:mainfrom
nickeddy:fix-command-signatures-271

Conversation

@nickeddy

@nickeddy nickeddy commented May 15, 2026

Copy link
Copy Markdown
Contributor

Switch files_for_staging_command to git ls-files -z so paths arrive NUL-separated
and unquoted; parse each record by taking everything after the 3-byte XY prefix
instead of splitting on whitespace, preserving filenames with spaces. Rename (R)
and copy (C) entries span two records — we keep the <to> path and skip the origin.

get_changed_or_tracked_files shared that post-processor but still emitted
newline-separated git status … | sed output, which the NUL parser collapsed into one
garbage suggestion. It now uses git diff [--cached] --diff-filter=AM --name-only -z
(git does the filtering — portable, unlike GNU-only sed -z), with its own NUL
path-splitting post-processor.

Tests added: test_post_process_diff_name_only (NUL paths incl. one with spaces),
_empty, _fatal_error. Existing files_for_staging tests already cover renames,
copies, spaces, and untracked dirs.

cargo fmt, cargo test both green.

@lucieleblanc lucieleblanc 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.

Hi @nickeddy , thank you for the fix. Since this change touches generators, could you provide screenshots of the generators working in a local build of Warp? The patch process is explained in the test-local-warp skill. If you're testing on MacOS, you can also use cmd-shift-5 to start a screen recording of the app.

I'll be happy to review this again once a screen capture or a set of screenshots showing the changes are uploaded and displayed in the PR description or a comment. Thanks!

@nickeddy nickeddy force-pushed the fix-command-signatures-271 branch from 90ade7e to 506d3e0 Compare May 27, 2026 17:17
@nickeddy

Copy link
Copy Markdown
Contributor Author

Here is a screenshot of the fix in action:
image

Running on latest warp with Cargo.toml bumped to my command-signatures version:

source = "git+https://github.com/nickeddy/command-signatures.git?rev=506d3e0b07031f81044a3f8661ae9a83c6633f51#506d3e0b07031f81044a3f8661ae9a83c6633f51"

@lucieleblanc lucieleblanc 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.

I agree with the general direction of these changes, but there are a few details we should clarify and another generator we should avoid regressing.

Comment thread command-signatures/src/generators/git.rs Outdated
Comment thread command-signatures/src/generators/git.rs Outdated

@lucieleblanc lucieleblanc 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.

A few more changes. In general, please prefer concise comments and clearer code, and comment inline in GitHub instead of adding comments about the diff in the diff itself.

Also, the PR description should not be this long. Please shorten it to explain the core of the change. The "verification" section should not include lints/fmt/clippy. Those are prerequisites; describe newly added/modified test cases instead.

Once again, please include screenshots of all affected generators in a comment to show they work as intended with all these edge cases. Thanks!

Comment thread command-signatures/src/generators/git.rs Outdated
Comment thread command-signatures/src/generators/git.rs Outdated
Comment thread command-signatures/src/generators/git.rs Outdated
@nickeddy

Copy link
Copy Markdown
Contributor Author

Testing on nickeddy/warp@becc1fd + nickeddy/command-signatures@208a88b after setting up the following git folder:

git init
echo orig > "old name.txt"
echo base > tracked.rs
mkdir "dir with space" && echo x > "dir with space/some file.rs"
git add -A && git commit -qm base
git mv "old name.txt" "new name.txt"
printf 'staged\n' >> tracked.rs && git add tracked.rs
printf 'unstaged\n' >> "dir with space/some file.rs"
echo new > "brand new.txt"
Screenshot from 2026-05-29 12-19-42 Screenshot from 2026-05-29 12-20-29

@lucieleblanc lucieleblanc self-requested a review June 3, 2026 17:11
@nickeddy nickeddy force-pushed the fix-command-signatures-271 branch from 208a88b to 6777e31 Compare June 4, 2026 16:25
@lucieleblanc lucieleblanc requested review from oz-agent and removed request for oz-agent June 4, 2026 16:39
oz-for-oss[bot]
oz-for-oss Bot previously requested changes Jun 4, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@lucieleblanc

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

Powered by Oz

@lucieleblanc lucieleblanc changed the title Fix git status parser to handle paths with spaces and renames (#271) Fix git status parser to handle paths with spaces and renames Jun 4, 2026
@lucieleblanc lucieleblanc linked an issue Jun 4, 2026 that may be closed by this pull request
@lucieleblanc

Copy link
Copy Markdown
Contributor

/oz-review

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Jun 4, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@lucieleblanc

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #271, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

Powered by Oz

@lucieleblanc

Copy link
Copy Markdown
Contributor

/oz-review

@warpdotdev warpdotdev deleted a comment from oz-for-oss Bot Jun 4, 2026
@oz-for-oss

oz-for-oss Bot commented Jun 4, 2026

Copy link
Copy Markdown

@lucieleblanc

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @lucieleblanc.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed stale reviews from themself June 4, 2026 21:09

Oz no longer requests changes for this pull request after the latest automated review.

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview

This PR updates the git command-signature file completion parser to consume NUL-separated git status --short -z and git diff --name-only -z output, preserving paths with spaces and correctly handling rename/copy records. The added tests cover spaces, renames, copies, empty output, and fatal-error handling.

Concerns

No blocking correctness, security, or spec-drift concerns found in the attached diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@acarl005

Copy link
Copy Markdown
Contributor

Hi @nickeddy I'm sorry for the delay. I'm the team member who will take over overseeing this PR.

@acarl005

Copy link
Copy Markdown
Contributor

Looks like we're conflicting with #279 which fixed a separate issue. You'll need to move your change into the fn files_for_staging_command they added.

@acarl005 acarl005 self-assigned this Jul 10, 2026
…acters

Rebased onto #279, which replaced the status-short files_for_staging
generator with a token-aware `git ls-files` one. The -z fix now lands in
that generator instead:

- files_for_staging_command: add -z to both ls-files invocations so paths
  arrive NUL-separated and raw (core.quotePath otherwise C-quotes
  non-ASCII/special filenames); post_process_files_for_staging splits on
  NUL instead of lines.
- get_changed_or_tracked_files: replace the `git status --short | sed`
  pipes with `git diff [--cached] --diff-filter=AM --name-only -z` and a
  NUL-splitting post_process_diff_name_only, preserving filenames with
  spaces (git does the filtering — portable, unlike GNU-only sed -z).
- Drop post_process_tracked_files, now unused.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nickeddy nickeddy force-pushed the fix-command-signatures-271 branch from 6777e31 to c1abbd4 Compare July 13, 2026 07:01
@nickeddy

Copy link
Copy Markdown
Contributor Author

Reworked against #279 and retested against my warp#11796 PR, confirmed working:
Screenshot_20260713_001541
Screenshot_20260713_001617

@acarl005 acarl005 enabled auto-merge (squash) July 13, 2026 20:12
@acarl005 acarl005 closed this Jul 13, 2026
auto-merge was automatically disabled July 13, 2026 20:13

Pull request was closed

@acarl005 acarl005 reopened this Jul 13, 2026
@oz-for-oss

oz-for-oss Bot commented Jul 13, 2026

Copy link
Copy Markdown

@acarl005

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@acarl005

Copy link
Copy Markdown
Contributor

CLA verification got stuck. closing and re-opening to un-stick

@acarl005 acarl005 enabled auto-merge (squash) July 13, 2026 20:14
@acarl005 acarl005 dismissed lucieleblanc’s stale review July 13, 2026 20:15

taking over this PR

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview

This PR updates the Git file suggestion generators to consume NUL-separated path output for git ls-files and git diff --name-only, preserving paths with spaces and avoiding shell-specific sed parsing. It also adds focused unit coverage for NUL-separated diff output, empty output, fatal errors, and staging suggestions with spaces.

Concerns

  • No blocking correctness issues found in the annotated diff.
  • No security findings identified in the changed lines.
  • spec_context.md contains no approved or repository spec context, so there were no spec commitments to validate against.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@acarl005

Copy link
Copy Markdown
Contributor

@cla-bot check

@cla-bot

cla-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@acarl005 acarl005 merged commit e273cec into warpdotdev:main Jul 13, 2026
7 checks passed
acarl005 pushed a commit to warpdotdev/warp that referenced this pull request Jul 13, 2026
## Description

Updates `warp-command-signatures` to ec1ae8e8.

### Merged PRs
- Fix git status parser to handle paths with spaces and renames
(warpdotdev/command-signatures#272)
- fix(git): complete nested untracked files for git add
(warpdotdev/command-signatures#279)
- Resolve update-command-spec-version repo paths dynamically
(warpdotdev/command-signatures#290)

## Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed `git status` completion parsing for paths with
spaces and renames, and completion of nested untracked files for `git
add`.

<!-- factory-client:
{"source":"factory-client","slack_channel":"C0BCE7AELJ2","slack_thread_ts":"1783976762.109799","slack_permalink":"https://warpdev.slack.com/archives/C0BCE7AELJ2/p1783976762109799?thread_ts=1783976762.109799&cid=C0BCE7AELJ2","oz_run_id":"019f5d4d-27c2-750d-823f-90a8b0a92b9c","repo":"warpdotdev/warp"}
-->

_Conversation:
https://staging.warp.dev/conversation/b34001b4-4abb-4cb1-be9d-98f75676605e_
_Run:
https://oz.staging.warp.dev/runs/019f5d4d-27c2-750d-823f-90a8b0a92b9c_

_This PR was generated with [Oz](https://warp.dev/oz)._

Co-authored-by: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git add <tab> truncates filenames containing spaces

3 participants