From 8b38f611761adfdffd219174b5d29a05b241c105 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:48 +0000 Subject: [PATCH] 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 --- tools/clean-branches | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/clean-branches b/tools/clean-branches index 915491bf46..a0af6417e6 100755 --- a/tools/clean-branches +++ b/tools/clean-branches @@ -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