From 87d65558efe50bb2cc3617bafd8399695212c0e5 Mon Sep 17 00:00:00 2001 From: Vikram Narayanan Date: Wed, 23 May 2012 09:01:06 +0000 Subject: 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 Acked-by: Simon Glass Cc: Simon Glass Cc: Wolfgang Denk --- tools/patman/gitutil.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools/patman/gitutil.py') diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 48ca9986505..59eca993413 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('') -- cgit v1.2.3