Browse Source

v2.2: fix logic in version bump script (backport of #6691) (#6727)

fix logic in version bump script (#6691)

* replace the whole script, not just the first match

* ensure running git checkout with tracked files

(cherry picked from commit 0214bd539a296318722a94082fa9d37e5c0136d8)

Co-authored-by: Yihau Chen <yihau.chen@icloud.com>
mergify[bot] 4 months ago
parent
commit
cfc140a08a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scripts/increment-cargo-version.sh

+ 2 - 2
scripts/increment-cargo-version.sh

@@ -129,7 +129,7 @@ for Cargo_toml in "${Cargo_tomls[@]}"; do
   # Set new crate version
   (
     set -x
-    sed -i "$Cargo_toml" -e "0,/^version =/{s/^version = \"[^\"]*\"$/version = \"$newVersion\"/}"
+    sed -i "$Cargo_toml" -e "s/^version = \"$currentVersion\"$/version = \"$newVersion\"/"
   )
 
   # Fix up the version references to other internal crates
@@ -183,7 +183,7 @@ scripts/cargo-for-all-lock-files.sh tree >/dev/null
   done
   mv "$tmp_file" filtered-cargo-lock-patch
 
-  git checkout ./**/Cargo.lock
+  git ls-files -- **/Cargo.lock | xargs -I {} git checkout {}
   git apply --unidiff-zero filtered-cargo-lock-patch
   rm cargo-lock-patch filtered-cargo-lock-patch
 )