From 98478c3b754321001f998a7acd55d63b709d9927 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 16 Jun 2023 04:35:44 +1000 Subject: [PATCH] fix(doc): Add `fastmod --hidden` to mass-renames.md (#6913) * Add `fastmod --hidden` to mass-renames.md * Do multiple skip paths * Do multiple sed renames in the same sed --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- book/src/dev/mass-renames.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/book/src/dev/mass-renames.md b/book/src/dev/mass-renames.md index cd9eda6d..9240d873 100644 --- a/book/src/dev/mass-renames.md +++ b/book/src/dev/mass-renames.md @@ -13,14 +13,14 @@ so changing them can lead to unexpected test failures or hangs. You can use `sed` to rename all the instances of a name in Zebra's code, documentation, and tests: ```sh git ls-tree --full-tree -r --name-only HEAD | \ -xargs sed -i 's/OldName/NewName/g' +xargs sed -i -e 's/OldName/NewName/g' -e 's/OtherOldName/OtherNewName/g' ``` Or excluding specific paths: ```sh git ls-tree --full-tree -r --name-only HEAD | \ -grep -v 'path-to-skip' | \ -xargs sed -i 's/OldName/NewName/g' +grep -v -e 'path-to-skip' -e 'other-path-to-skip' | \ +xargs sed -i -e 's/OldName/NewName/g' -e 's/OtherOldName/OtherNewName/g' ``` `sed` also supports regular expressions to replace a pattern with another pattern. @@ -47,7 +47,8 @@ git worktree add ../zebra-pr origin/pr-branch-name cd ../zebra-sed # run the scripts in the PR or commit message git ls-tree --full-tree -r --name-only HEAD | \ -xargs sed -i 's/OldName/NewName/g' +grep -v -e 'path-to-skip' -e 'other-path-to-skip' | \ +xargs sed -i -e 's/OldName/NewName/g' -e 's/OtherOldName/OtherNewName/g' cargo fmt --all ``` @@ -66,9 +67,11 @@ and ask the author to re-run the script on the latest `main`. You can use `fastmod` to rename some instances, but skip others: ```sh -fastmod --fixed-strings "OldName" "NewName" [paths to change] +fastmod --hidden --fixed-strings "OldName" "NewName" [paths to change] ``` +Using the `--hidden` flag does renames in `.github` workflows, issue templates, and other configs. + `fastmod` also supports regular expressions to replace a pattern with another pattern. Here's how to make a PR with these replacements: