[ai] Use porcelain git status parsing#13
Conversation
WalkthroughThe change modifies the git status parsing logic in the bashy script. It replaces a Related PRs: None identified. Suggested labels: bug, refactor Suggested reviewers: pablopunk 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bashy`:
- Around line 37-41: The status parsing in the bashy case branch only marks
deletions and modifications, so staged additions, renames, copies, and conflict
states are missed. Update the `status="${line:0:2}"` handling to recognize `A`,
`R`, and `C` symbols as changed entries, and also treat conflict pairs like `AA`
and `UU` as visible statuses. Keep the logic localized to the existing status
switch/branch so the rest of the parser continues to work unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| *) | ||
| status="${line:0:2}" | ||
| [[ $status == *D* ]] && delete=1 | ||
| [[ $status == *M* ]] && change=1 | ||
| ;; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the file and inspect the relevant lines with context.
git ls-files | rg '(^|/)bashy$|bashy\.sh$|bashy$'
echo '---'
if [ -f bashy ]; then
nl -ba bashy | sed -n '1,120p'
else
fd -a '^bashy$|^bashy\.sh$' .
fiRepository: pablopunk/bashy
Length of output: 203
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for status parsing around the cited logic.
rg -n --no-heading -C 3 'status="\$\{line:0:2\}"|new=1|delete=1|change=1|git status|porcelain' .Repository: pablopunk/bashy
Length of output: 807
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show the full script so the affected output path is clear.
awk '{printf "%4d %s\n", NR, $0}' bashy | sed -n '1,140p'Repository: pablopunk/bashy
Length of output: 1813
Handle A, R, and C status codes
git status --porcelain entries like A , R , and C fall through here with no symbol, so staged additions, renames, and copies are invisible. Conflict pairs such as AA and UU are also blank.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bashy` around lines 37 - 41, The status parsing in the bashy case branch only
marks deletions and modifications, so staged additions, renames, copies, and
conflict states are missed. Update the `status="${line:0:2}"` handling to
recognize `A`, `R`, and `C` symbols as changed entries, and also treat conflict
pairs like `AA` and `UU` as visible statuses. Keep the logic localized to the
existing status switch/branch so the rest of the parser continues to work
unchanged.
|
Closing per maintainer request; current parser still misses staged additions/renames/copies/conflicts. |
What
Make git status parsing robust for filenames with spaces.
Found by
Scanner category: bug/tooling
Fix
Use machine-readable git status --porcelain output instead of human-readable status parsing.
Tested
🤖 [ai] — auto-fix by Hermes Autonomous Orchestrator
Summary by CodeRabbit