fix: silence git fetch stdout to prevent branch number parse error#1696
Open
fsilvaortiz wants to merge 2 commits intogithub:mainfrom
Open
fix: silence git fetch stdout to prevent branch number parse error#1696fsilvaortiz wants to merge 2 commits intogithub:mainfrom
fsilvaortiz wants to merge 2 commits intogithub:mainfrom
Conversation
`git fetch --all` can write status text (e.g., "Fetching origin...") to stdout, which gets captured by command substitution in check_existing_branches(). This contaminates BRANCH_NUMBER with non-numeric text, causing `$((10#$BRANCH_NUMBER))` to fail with "value too great for base". Redirect both stdout and stderr to /dev/null instead of stderr only. Closes github#1592 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cing Adds 5 tests covering: - Valid JSON output from --json flag - FEATURE_NUM is always a zero-padded numeric string - No git fetch stdout leaks into JSON output - Repeated runs produce clean JSON without fetch artifacts - Regression guard: git fetch redirects both stdout and stderr Tests that require git are marked with skipif so they degrade gracefully in environments without git installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
db3da6f to
a45e9f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
create-new-feature.sh --jsonfailing with:Root cause:
git fetch --all --prune 2>/dev/nullonly silences stderr. Whengit fetchwrites status text (e.g.,Fetching origin...) to stdout, it gets captured by command substitution incheck_existing_branches(), contaminatingBRANCH_NUMBERwith non-numeric text. The subsequent$((10#$BRANCH_NUMBER))then fails.Fix: Redirect both stdout and stderr to
/dev/null:Closes #1592
Test plan
git fetchtests/test_create_new_feature.py:test_json_output_is_valid— JSON output has correct keystest_feature_num_is_numeric— FEATURE_NUM is always zero-padded numerictest_script_does_not_leak_git_fetch_stdout— no fetch noise in stdouttest_script_does_not_leak_git_fetch_to_json— repeated runs produce clean JSONtest_git_fetch_redirect_pattern_in_script— regression guard for the redirect pattern (no git required)pytest.mark.skipiffor environments without gitAI Assistance Disclosure
This PR was drafted with assistance from Claude Code (Anthropic). The root cause analysis, fix, and tests were validated manually by the author.
🤖 Generated with Claude Code