7 echo "Usage: $0 [--no-compile|--amend] <filename>"
8 echo "You must be at the base of the kernel tree to run this."
14 echo -n "Do you want to fix these issues now? "
16 if ! echo $ans |
grep -iq ^n
; then
28 if ! echo $ans |
grep -qi ^y
; then
36 NAME
=$
(git config
--get user.name
)
37 EMAIL
=$
(git config
--get user.email
)
38 NAME_EMAIL
=$
(echo ${NAME} \
<${EMAIL}\
>)
41 if [[ "$1" == "--no-compile" ]] ; then
44 elif [[ "$1" == "--amend" ]] ; then
57 filename
=$
(basename $fullname)
58 oname
=$
(echo ${fullname/.c/.o})
60 MSG_FILE
=$TMP_DIR/${filename}.msg
61 MAIL_FILE
=$TMP_DIR/${filename}.
mail
62 WARN_FILE
=$TMP_DIR/${filename}.warn
64 # heat up the disk cache
65 #git log --oneline $fullname | head -n 10 > /dev/null &
68 qc
"Have you handled all the errors properly?"
69 if git
diff $fullname |
grep ^
+ |
grep -qi alloc
; then
70 qc
"Have you freed all your mallocs?"
72 if git
diff $fullname |
grep ^
+ |
grep -qi alloc
; then
73 qc
"Have you check all your mallocs for NULL returns?"
76 if [ "$NO_COMPILE" != "true" ] ; then
77 kchecker
--spammy $fullname |
tee $WARN_FILE
78 kchecker
--sparse --endian $fullname 2>&1 |
tee -a $WARN_FILE
80 # make C=1 CHECK="scripts/coccicheck" $oname
83 for file in $
(grep -l $fullname ~
/var
/mail
/sent-
*) ; do
84 grepmail
$fullname $file |
grep -i ^subject ||
echo -n ""
88 cat /dev
/null
> $MSG_FILE
89 if [ "$AMEND" != "" ] ; then
90 git format-patch HEAD^
--stdout >> $MSG_FILE
93 echo "Signed-off-by: ${NAME_EMAIL}" >> $MSG_FILE
95 echo "# $sm_err" >> $MSG_FILE
97 git log
-10 --oneline --format="%h (\"%s\")" $fullname |
sed -e 's/^/# /' >> $MSG_FILE
99 egrep '(error|warn|info)' $WARN_FILE |
sed -e 's/^/# /' >> $MSG_FILE
100 git
diff $fullname |
sed -e 's/^/# /' >> $MSG_FILE
103 grep -v '^#' $MSG_FILE > $MSG_FILE.1
104 mv $MSG_FILE.1 $MSG_FILE
107 git commit
$AMEND -F $MSG_FILE
109 git format-patch HEAD^
--stdout >> $MSG_FILE
111 to_addr
=$
(.
/scripts
/get_maintainer.pl
--noroles --norolestats $MSG_FILE |
head -n 1)
112 cc_addr
=$
(.
/scripts
/get_maintainer.pl
--noroles --norolestats $MSG_FILE |
tail -n +2 | \
113 perl
-ne 's/\n$/, /; print')
114 cc_addr
="$cc_addr, kernel-janitors@vger.kernel.org"
116 echo -n "To: " > $MAIL_FILE
117 echo "$to_addr" >> $MAIL_FILE
118 echo -n "CC: " >> $MAIL_FILE
119 echo "$cc_addr" >> $MAIL_FILE
120 echo "X-Mailer: git-send-email haha only kidding" >> $MAIL_FILE
122 git format-patch HEAD^
--stdout >> $MAIL_FILE
124 .
/scripts
/checkpatch.pl
$MAIL_FILE || continue_yn
126 echo "Press ENTER to continue"