summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2022-01-08 02:15:55 +0300
committerSimon Glass <sjg@chromium.org>2022-01-13 19:13:41 +0300
commitdca7926c2cb82ff4aea665ed97e38520d39865a5 (patch)
tree6d895e72d9d1b4f6bbdc7817b84d7c68fd09a955 /tools
parentd8ef446fec1d5dde5a6238f452d04cda81f8752a (diff)
downloadu-boot-dca7926c2cb82ff4aea665ed97e38520d39865a5.tar.xz
patman: Support absolute and ~user-relative alias files
Python doesn't naturally support tilde (~) as a user-home marker in paths, but git-config does. So we need to resolve it before continuing. We also shouldn't blindly join the top-level tree with the aliasesfile path, because it might be an absolute path. This resolves warnings like the following: Warning: Cannot find alias file '/path/to/source/tree/~/.git-email' Seen when git-config is like: $ git config sendemail.aliasesfile ~/.git-email Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'tools')
-rw-r--r--tools/patman/gitutil.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 5e4c1128dc..e1ef96df22 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -616,9 +616,14 @@ def GetAliasFile():
"""
fname = command.OutputOneLine('git', 'config', 'sendemail.aliasesfile',
raise_on_error=False)
- if fname:
- fname = os.path.join(GetTopLevel(), fname.strip())
- return fname
+ if not fname:
+ return None
+
+ fname = os.path.expanduser(fname.strip())
+ if os.path.isabs(fname):
+ return fname
+
+ return os.path.join(GetTopLevel(), fname)
def GetDefaultUserName():
"""Gets the user.name from .gitconfig file.