Remove name from email addresses
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 12 Apr 2023 19:29:44 +0000 (15:29 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 1 Jun 2023 19:16:14 +0000 (15:16 -0400)
scripts/kernel-send-patches.sh

index 07c725e..9aae586 100755 (executable)
@@ -166,6 +166,22 @@ find_commit_by_log()
     echo $(git log --oneline HEAD~100..HEAD | grep "${1}" | awk {'print $1'})
 }
 
+# Remove "Name" if present in email address. Needed because of a bug in
+# get_maintainer.pl even if we specify the "--non" option.
+# Arg #1: "Name <email>" or "email"
+format_email()
+{
+    local mail="${1}"
+
+    if echo "${mail}" | grep -q '<'; then
+        mail=$(echo ${mail} | sed "s@.*<\(.*\)>@\1@")
+    else
+        mail="${mail}"
+    fi
+
+    echo "${mail}"
+}
+
 # Because the cover letter is a special case and not a real patch, running
 # get_maintainer.pl on it would not return any TO or CC addresses.
 # Therefore, manually run get_maintainer.pl on the concatenation of all the
@@ -180,10 +196,12 @@ collect_email_addresses()
     CC_MAIL="$(${CC_CMD} /tmp/all.patch)"
 
     while IFS= read -r line; do
+        line=$(format_email "${line}")
         TO_OPTS="${TO_OPTS} --to ${line}"
     done <<< "${TO_MAIL}"
 
     while IFS= read -r line; do
+        line=$(format_email "${line}")
         CC_OPTS="${CC_OPTS} --cc ${line}"
     done <<< "${CC_MAIL}"
 }