revert: undo backslash filename handling in _forgit_worktree_changes#505
revert: undo backslash filename handling in _forgit_worktree_changes#505
Conversation
Reverts commmit 2c17635, because it introduced a regression on older git versions where `_forgit_add` no longer showed untracked files.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughModified Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wfxr
left a comment
There was a problem hiding this comment.
I wonder if we can avoid the full revert here and keep the backslash fix from 2c17635.
Instead of switching _forgit_worktree_changes() back to git status -s, could we keep the current git ... status --porcelain -zs ... | tr '\0' '\n' pipeline and add a small fallback before the grep?
Concretely, we could normalize uncolored ?? lines to use color.status.untracked, and then continue with the existing grep / sed pipeline unchanged.
That should preserve both behaviors:
- untracked files remain visible on older Git versions
- filenames containing backslashes continue to work correctly
This seems preferable to reintroducing #467 and dropping its test coverage.
Something along these lines, for example:
git ... status --porcelain -zs --untracked=... |
tr '\0' '\n' |
_forgit_restore_untracked_color |
grep -F -e "$changed" -e "$unmerged" -e "$untracked" |
sed -E 's/^(..[^[:space:]]*)[[:space:]]+(.*)$/[\1] \2/'where _forgit_restore_untracked_color only patches plain ?? lines and leaves already-colorized output untouched.
|
That sounds like a good idea. However, I currently lack the time to implement this before the next monthly release, which is why I opted for the revert first and wanted to implement a proper fix later. If you do have the time, please open a PR and I'll do my best to review it in time - otherwise I would like to merge this one instead of releasing a broken forgit version. |
No problem, that sounds reasonable. I’ll open a PR for the fallback approach shortly and we can see if it can make it in before the release. EDIT PTAL #506 |
Check list
Description
Reverts commmit 2c17635, because it introduced a regression on older git versions where
_forgit_addno longer showed untracked files.Closes #503
Type of change
Test environment
Summary by CodeRabbit