Print this page
4389 webrev should fetch preparer info from git if available

@@ -24,10 +24,11 @@
 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Copyright 2008, 2010, Richard Lowe
 # Copyright 2012 Marcel Telka <marcel@telka.sk>
+# Copyright 2013 Ivan Richwalski <ivan@seppuku.net>
 
 #
 # This script takes a file list and a workspace and builds a set of html files
 # suitable for doing a code review of source changes via a web page.
 # Documentation is available via the manual page, webrev.1, or just

@@ -3478,20 +3479,28 @@
 #
 # If the SCM detected is Mercurial, and the configuration property
 # ui.username is available, use that, but be careful to properly escape
 # angle brackets (HTML syntax characters) in the email address.
 #
+# For git, use the user.name and user.email properties if they are set.
+#
 # Otherwise, use the current userid in the form "John Doe (jdoe)", but
 # to maintain compatibility with passwd(4), we must support '&' substitutions.
 #
 preparer=
 if [[ "$SCM_MODE" == mercurial ]]; then
         preparer=`hg showconfig ui.username 2>/dev/null`
-        if [[ -n "$preparer" ]]; then
-                preparer="$(echo "$preparer" | html_quote)"
+elif [[ "$SCM_MODE" == git ]]; then
+        preparer=$( git config user.name 2>/dev/null )
+        prepmail=$( git config user.email 2>/dev/null )
+        if [[ -n "$prepmail" ]]; then
+                preparer="$preparer <$prepmail>"
         fi
 fi
+if [[ -n "$preparer" ]]; then
+        preparer="$(echo "$preparer" | html_quote)"
+fi
 if [[ -z "$preparer" ]]; then
         preparer=$(
             $PERL -e '
                 ($login, $pw, $uid, $gid, $quota, $cmt, $gcos) = getpwuid($<);
                 if ($login) {