]> git.ozlabs.org Git - next-scripts/commitdiff
message_helper: more "gentele" coding style
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Jun 2019 07:26:35 +0000 (17:26 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Jun 2019 07:26:35 +0000 (17:26 +1000)
more consistent quoting

message_helper

index 48e2428565d98e5d7273d5194adcf6d9ebe9c2b0..08b6649d9984fc327268f71449ccd289d88e9061 100755 (executable)
@@ -1,35 +1,38 @@
 #!/bin/bash
 
 # shellcheck source=./common.sh
-. "$(dirname "$0")/common.sh" ""
+. "$(dirname "$0")/common.sh" ''
 
 log="$LOG_FILE"
-[ -f merge.log ] && log=merge.log
+if [ -f merge.log ]; then
+       log='merge.log'
+fi
 
-branch=""
-[ "$1" = "-t" ] && {
-        branch=$2
+branch=
+if [ "$1" = '-t' ]; then
+        branch="$2"
         shift 2
-}
+fi
 
-kconfig=""
-[ "$1" = "-c" ] && {
-        kconfig=$2
+kconfig=
+if [ "$1" = '-c' ]; then
+        kconfig="$2"
         shift 2
-}
+fi
 
 cc='Linux Next Mailing List <linux-next@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>'
 
-[ "$branch" ] || {
-       branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
-       branch=${branch%%/*}
-}
+if [ -z "$branch" ]; then
+       branch=$(grep '^Merging ' "$log" | tail -n 1 |
+               sed 's/^Merging \([^ /]*\).*$/\1/')
+fi
 
 contact=$(get_contacts "$branch")
-subject="${1//BRANCH/$branch}"
+subject=${1//BRANCH/$branch}
 filter="sed -e 's/BRANCH/$branch/g'"
-[ "$kconfig" ] &&
+if [ "$kconfig" ]; then
        filter="$filter -e 's/KCONFIG_NAME/$kconfig/g'"
+fi
 filter="$filter | fmt -s"
 
 { printf 'Hi all,\n\n'; eval "$filter"; } |