fix: replace xargs trim with sed to handle quotes in descriptions#2351
Merged
mnriem merged 1 commit intogithub:mainfrom Apr 24, 2026
Merged
fix: replace xargs trim with sed to handle quotes in descriptions#2351mnriem merged 1 commit intogithub:mainfrom
mnriem merged 1 commit intogithub:mainfrom
Conversation
xargs re-parses stdin as shell tokens, causing 'unterminated quote' errors when feature descriptions contain apostrophes, double quotes, or backslashes. Replace with sed-based whitespace trim that preserves input verbatim. Add regression tests for special characters in descriptions (core and extension scripts), plus a negative test for whitespace-only input. Fixes github#2339
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a quoting bug in the create-new-feature.sh whitespace-trimming step by replacing xargs (which re-parses input and fails on quotes/backslashes) with a sed-based trim, and adds regression tests to ensure descriptions containing special characters work in both core and extension scripts.
Changes:
- Replace
FEATURE_DESCRIPTIONtrimming fromxargsto a quote-safesedexpression in both bash scripts. - Add pytest coverage for apostrophes, double quotes, and backslashes (core + extension), plus whitespace-only rejection and a plain-description guard.
Show a summary per file
| File | Description |
|---|---|
scripts/bash/create-new-feature.sh |
Switches whitespace trimming to sed to avoid xargs quote/backslash parsing failures. |
extensions/git/scripts/bash/create-new-feature.sh |
Applies the same trim fix to the git extension’s create-new-feature.sh. |
tests/test_timestamp_branches.py |
Adds regression tests for issue #2339 covering special characters and whitespace-only descriptions. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
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
create-new-feature.shusesxargsto strip surrounding whitespace from theFEATURE_DESCRIPTIONargument. Becausexargsre-parses its stdin as shell-like tokens, any input containing a single quote ('), double quote ("), or backslash (\) aborts withxargs: unterminated quote.Natural-language descriptions frequently include apostrophes (
user's,can't, etc.), so this is easy to trigger in normal usage.Changes
Replace the
xargscall with ased-based trim in both locations:scripts/bash/create-new-feature.sh(line 87)extensions/git/scripts/bash/create-new-feature.sh(line 98)The PowerShell equivalents already use
.Trim()and are not affected.Tests
Added
TestDescriptionQuotingclass totests/test_timestamp_branches.pywith 10 tests:Full suite: 1677 passed.
Fixes #2339