Skip to content

Commit

Permalink
Merge pull request #45 from cisagov/bug/fix_overly_matching_sed_command
Browse files Browse the repository at this point in the history
Fix overly match-happy sed commands
  • Loading branch information
mcdonnnj authored Sep 26, 2024
2 parents a2f3c99 + 499eedf commit f56abcc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bump-version
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ END_OF_LINE
)

old_version=$(< "$VERSION_FILE")
# Comment out periods so they are interpreted as periods and don't
# just match any character
old_version_regex=${old_version//\./\\\.}
new_version="$old_version"

bump_part=""
Expand Down Expand Up @@ -143,9 +146,9 @@ if [ "$with_prerelease" = true ]; then
fi

tmp_file=/tmp/version.$$
sed "s/$old_version/$new_version/" $VERSION_FILE > $tmp_file
sed "s/$old_version_regex/$new_version/" $VERSION_FILE > $tmp_file
mv $tmp_file $VERSION_FILE
sed "s/$old_version/$new_version/" $README_FILE > $tmp_file
sed "s/$old_version_regex/$new_version/" $README_FILE > $tmp_file
mv $tmp_file $README_FILE
git add $VERSION_FILE $README_FILE
git commit --message "$commit_prefix version from $old_version to $new_version"
Expand Down

0 comments on commit f56abcc

Please sign in to comment.