Fix support for AUTHOR presubmit check in git cl.

Properly load --contributor value or use the git config user.email value.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7134097

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@88979 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 3ffa9ad..7e76786 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -510,7 +510,8 @@
       self.SetPatchset(0)
     self.has_issue = False
 
-  def RunHook(self, committing, upstream_branch, tbr, may_prompt, verbose):
+  def RunHook(self, committing, upstream_branch, tbr, may_prompt, verbose,
+      author):
     """Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
     root = RunCommand(['git', 'rev-parse', '--show-cdup']).strip() or '.'
     absroot = os.path.abspath(root)
@@ -530,6 +531,9 @@
       # with these log messages.
       description = RunCommand(['git', 'log', '--pretty=format:%s%n%n%b',
                                 '%s...' % (upstream_branch)]).strip()
+
+    if not author:
+      author = RunGit(['config', 'user.email'])
     change = presubmit_support.GitChange(
         name,
         description,
@@ -537,7 +541,7 @@
         files,
         issue,
         patchset,
-        None)
+        author)
 
     # Apply watchlists on upload.
     if not committing:
@@ -893,7 +897,8 @@
     base_branch = cl.GetUpstreamBranch()
 
   cl.RunHook(committing=not options.upload, upstream_branch=base_branch,
-             tbr=False, may_prompt=False, verbose=options.verbose)
+             tbr=False, may_prompt=False, verbose=options.verbose,
+             author=None)
   return 0
 
 
@@ -939,7 +944,8 @@
   if not options.bypass_hooks and not options.force:
     hook_results = cl.RunHook(committing=False, upstream_branch=base_branch,
                               tbr=False, may_prompt=True,
-                              verbose=options.verbose)
+                              verbose=options.verbose,
+                              author=None)
     if not options.reviewers and hook_results.reviewers:
       options.reviewers = hook_results.reviewers
 
@@ -1094,7 +1100,8 @@
 
   if not options.bypass_hooks and not options.force:
     cl.RunHook(committing=True, upstream_branch=base_branch,
-               tbr=options.tbr, may_prompt=True, verbose=options.verbose)
+               tbr=options.tbr, may_prompt=True, verbose=options.verbose,
+               author=options.contributor)
 
     if cmd == 'dcommit':
       # Check the tree status if the tree status URL is set.