[maintainer-tools PATCH 5/7] dim: move empty name logic to function

Eric Engestrom eric.engestrom at imgtec.com
Wed Aug 9 11:10:59 UTC 2017


Fair warning: this slightly changes the behaviour, as $testname would
previously contain the email if $testcc didn't contain a name.
Shouldn't affect anything though.

Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
 dim | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dim b/dim
index 4ffac497c621..481a53e23035 100755
--- a/dim
+++ b/dim
@@ -1965,7 +1965,9 @@ function email_get_address
 
 function email_get_name
 {
-	sed -e 's/[[:space:]]*<.*$//' <<< "$1"
+	if grep -q '<' <<< "$1"; then
+		sed -e 's/[[:space:]]*<.*$//' <<< "$1"
+	fi
 }
 
 function dim_add_missing_cc
@@ -1977,11 +1979,7 @@ function dim_add_missing_cc
 
 	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
 		email="$(email_get_address "$cc")"
-		name=''
-
-		if echo "$cc" | grep -q '<'; then
-			name="$(email_get_name "$cc")";
-		fi
+		name="$(email_get_name "$cc")"
 
 		# Don't add main mailing lists
 		if [ "$email" = "dri-devel at lists.freedesktop.org" -o \
-- 
Cheers,
  Eric



More information about the dri-devel mailing list