From: Stephen Rothwell Date: Tue, 22 Jan 2019 03:39:58 +0000 (+1100) Subject: check_fixes: a few cleanups X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=8d005867845651e014c233986a6ebe69d5e3744f;p=next-scripts check_fixes: a few cleanups include most shellcheck issues --- diff --git a/check_fixes b/check_fixes index 8618b08..954ad55 100755 --- a/check_fixes +++ b/check_fixes @@ -10,8 +10,8 @@ if [ -z "$commits" ]; then exit 0 fi +# This should be a git tree that contains *only* Linus' tree Linus_tree="${HOME}/kernels/linus.git" -done_file="${HOME}/tmp/check_fixes_done" split_re='^([[:xdigit:]]+)[[:space:]]+(.*)$' nl=$'\n' @@ -22,27 +22,16 @@ strip_spaces() } for c in $commits; do - if [ -r "$done_file" ] && grep -q -Fx "$c" "$done_file"; then - continue - fi - commit_msg="In commit + commit_log=$(git log -1 --format='%h ("%s")' "$c") + commit_msg=$(printf 'In commit\n\n %s\n\n' "$commit_log") - $(git log -1 --format='%h ("%s")' $c) - -" fixes_lines=$(git log -1 --format='%B' "$c" | grep -i '^[[:space:]]*Fixes:') - while read fline; do + while read -r fline; do f=$(echo "$fline" | sed 's/^[[:space:]]*Fixes:[[:space:]]*//i') - fixes_msg="Fixes tag - - $fline - -has these problem(s): - -" + fixes_msg=$(printf 'Fixes tag\n\n %s\n\n has these problem(s):\n\n' "$fline") sha= subject= msg= @@ -118,7 +107,7 @@ has these problem(s): if [ "$subject" != "${target_subject:0:${#subject}}" ]; then msg="${msg:+${msg}${nl}} - Subject does not match target commit subject" fi - lsha=$(cd $Linus_tree; git rev-parse -q --verify "$sha") + lsha=$(cd "$Linus_tree" && git rev-parse -q --verify "$sha") if [ -z "$lsha" ]; then count=$(git rev-list --count "$sha".."$c") if [ "$count" -eq 0 ]; then