]> git.ozlabs.org Git - next-scripts/blobdiff - check_fixes
check_fixes: a few cleanups
[next-scripts] / check_fixes
index 8618b08c3f8a16caf7502c1f88c97a45c4a070e7..954ad553d04f023fe950b9471181b50340d33ab8 100755 (executable)
@@ -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