fix: make reset-version portable across BSD and GNU sed#211
Merged
Conversation
sed -i -E on macOS was broken because BSD sed's -i requires an explicit backup-suffix argument, so it consumed -E as that suffix instead of enabling extended regex. This left capture groups undefined, causing "\1 not defined in the RE". Detect the OS via uname and pick the correct in-place sed invocation, and drop a stray space in the replacement that produced version = " 0.0.1".
NaffanDroo
enabled auto-merge (squash)
July 1, 2026 18:44
Contributor
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
NaffanDroo
disabled auto-merge
July 1, 2026 18:44
NaffanDroo
enabled auto-merge (squash)
July 1, 2026 18:45
NaffanDroo
disabled auto-merge
July 1, 2026 18:45
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
make reset-versionwas broken on macOS: BSDsed -irequires an explicit backup-suffix argument, so-i -Econsumed-Eas that suffix instead of enabling extended regex, leaving\1/\3undefined ("\1 not defined in the RE").version = " 0.0.1"instead ofversion = "0.0.1".uname -sand usessed -i ''on Darwin, plainsed -ielsewhere, so the target now works on both BSD (macOS) and GNU (Linux) sed.Test plan
make reset-versionon macOS — confirmspyproject.toml,src/tidy_python/__init__.py, and the test comment are correctly rewritten to0.0.1