summaryrefslogtreecommitdiff
path: root/tools/patman/gitutil.py
diff options
context:
space:
mode:
authorVikram Narayanan <vikram186@gmail.com>2012-05-23 09:01:06 +0000
committerWolfgang Denk <wd@denx.de>2012-06-19 22:51:55 +0200
commit87d65558efe50bb2cc3617bafd8399695212c0e5 (patch)
tree0b21809e60f6408fd84c0eda3029a841176a39ce /tools/patman/gitutil.py
parent2b36c75d7b930a860ec17f2af3321faa5811593b (diff)
patman: Handle creation of patman config file
patman shouts when it couldn't find a $(HOME)/.patman file. Handle it in a sane way by creating a new one for the user. It looks for a user.name and user.email in the global .gitconfig file, waits for the user input if it can't find there. Update the same in the README Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'tools/patman/gitutil.py')
-rw-r--r--tools/patman/gitutil.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 48ca998650..59eca99341 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -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('')