Flip counters to pre-increment to avoid bash evaluating it as 'failure' and exiting - #151
Flip counters to pre-increment to avoid bash evaluating it as 'failure' and exiting#151mark-brannan wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe ChangesRepository counter handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change makes repository clone and skip counters safe under Bash errexit behavior. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The run script was failing for me immediately after the first clone. Then it would fail immediately after the first skip.
The problem is this type of usage in bash with
errexit:If the variable contains a zero value, bash evaluates the line to 'Failure' (1) and the script halts.
Pre-increment sidesteps this:
My original run and subsequent attempts looked like this:
But then show status would catch it:
Testing the change:
I'm on WSL/Ubuntu on my windows machine:
Have not tried in on the shell on my mac but I usually use zsh there; not sure if there is some variation in how different bash versions treat the pre-increment and post-increment.
Summary by CodeRabbit