clean-branches: Fix shellcheck warnings.

In tools/clean-branches line 33:
                echo -n "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')"
                                                 ^-- SC2001: See if you can use ${variable//search/replace} instead.

In tools/clean-branches line 41:
                echo -n "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')"
                                                 ^-- SC2001: See if you can use ${variable//search/replace} instead.

In tools/clean-branches line 49:
                remote_name="$(echo "$ref" | sed 's!^refs/remotes/origin/!!')"
                               ^-- SC2001: See if you can use ${variable//search/replace} instead.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-03 00:14:48 +00:00 committed by Tim Abbott
parent b5bfe77844
commit 8b38f61176
1 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ function clean_ref {
refs/heads/review-*)
if [ $review -ne 0 ]; then
echo -n "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')"
echo -n "Deleting local branch ${ref#refs/heads/}"
echo " (was $(git rev-parse --short "$ref"))"
git update-ref -d "$ref"
fi
@ -38,7 +38,7 @@ function clean_ref {
refs/heads/*)
if is_merged "$ref"; then
echo -n "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')"
echo -n "Deleting local branch ${ref#refs/heads/}"
echo " (was $(git rev-parse --short "$ref"))"
git update-ref -d "$ref"
fi
@ -46,7 +46,7 @@ function clean_ref {
refs/remotes/origin/$USER-*)
if is_merged "$ref"; then
remote_name="$(echo "$ref" | sed 's!^refs/remotes/origin/!!')"
remote_name="${ref#refs/remotes/origin/}"
echo -n "Deleting remote branch $remote_name"
echo " (was $(git rev-parse --short "$ref"))"
# NB: this won't handle spaces in ref names