Skip to content

[ai] Use porcelain git status parsing#13

Closed
pablopunk wants to merge 1 commit into
masterfrom
ai/pablopunk__bashy-6010
Closed

[ai] Use porcelain git status parsing#13
pablopunk wants to merge 1 commit into
masterfrom
ai/pablopunk__bashy-6010

Conversation

@pablopunk

@pablopunk pablopunk commented Jul 6, 2026

Copy link
Copy Markdown
Owner

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

  • Existing/smoke tests pass
  • Manually verified: repo with files containing spaces does not break parsing

🤖 [ai] — auto-fix by Hermes Autonomous Orchestrator

Summary by CodeRabbit

  • Bug Fixes
    • Improved repository status detection so changed, deleted, new, ahead, and behind files are reported more reliably.

@pablopunk pablopunk added the ai label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change modifies the git status parsing logic in the bashy script. It replaces a for line in $gitstatus loop, which relied on word-splitting and regex checks, with a while IFS= read -r line loop combined with a case statement. The new logic sets new based on the ?? prefix, derives delete and change from the two-character status segment, and sets ahead/behind flags by checking for corresponding markers within each line.

Related PRs: None identified.

Suggested labels: bug, refactor

Suggested reviewers: pablopunk

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: switching to porcelain git status parsing for robustness.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9dd7c2d8-68c3-4eb9-8b3e-02ba47ec25aa

📥 Commits

Reviewing files that changed from the base of the PR and between 9af56ab and ade8198.

📒 Files selected for processing (1)
  • bashy

Comment thread bashy
Comment on lines +37 to +41
*)
status="${line:0:2}"
[[ $status == *D* ]] && delete=1
[[ $status == *M* ]] && change=1
;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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$' .
fi

Repository: 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.

@pablopunk

Copy link
Copy Markdown
Owner Author

Closing per maintainer request; current parser still misses staged additions/renames/copies/conflicts.

@pablopunk pablopunk closed this Jul 6, 2026
@pablopunk pablopunk deleted the ai/pablopunk__bashy-6010 branch July 6, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant