Merge branch 'master' of git://git.denx.de/u-boot into master
[oweals/u-boot.git] / tools / patman / gitutil.py
index 48ca998650592ec275453dbb43e4e7067a6aeac0..72d37a0b04e5bd752b107a95c15c700f33ff4164 100644 (file)
@@ -38,7 +38,7 @@ def CountCommitsToBranch():
     Return:
         Number of patches that exist on top of the branch
     """
-    pipe = [['git', 'log', '--oneline', '@{upstream}..'],
+    pipe = [['git', 'log', '--no-color', '--oneline', '@{upstream}..'],
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True)
     patch_count = int(stdout)
@@ -357,6 +357,24 @@ def GetAliasFile():
         fname = os.path.join(GetTopLevel(), fname.strip())
     return fname
 
+def GetDefaultUserName():
+    """Gets the user.name from .gitconfig file.
+
+    Returns:
+        User name found in .gitconfig file, or None if none
+    """
+    uname = command.OutputOneLine('git', 'config', '--global', 'user.name')
+    return uname
+
+def GetDefaultUserEmail():
+    """Gets the user.email from the global .gitconfig file.
+
+    Returns:
+        User's email found in .gitconfig file, or None if none
+    """
+    uemail = command.OutputOneLine('git', 'config', '--global', 'user.email')
+    return uemail
+
 def Setup():
     """Set up git utils, by reading the alias files."""
     settings.Setup('')