All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] patman: Support absolute and ~user-relative alias files
@ 2022-01-07 23:15 Brian Norris
  2022-01-12 21:21 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Norris @ 2022-01-07 23:15 UTC (permalink / raw)
  To: Simon Glass; +Cc: Brian Norris, u-boot

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>
---

 tools/patman/gitutil.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 5e4c1128dcb5..e1ef96df22ec 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.
-- 
2.34.1.575.g55b058a8bb-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] patman: Support absolute and ~user-relative alias files
  2022-01-07 23:15 [PATCH] patman: Support absolute and ~user-relative alias files Brian Norris
@ 2022-01-12 21:21 ` Simon Glass
  2022-01-13 12:03   ` Otavio Salvador
  2022-01-13 18:00   ` Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2022-01-12 21:21 UTC (permalink / raw)
  To: Brian Norris, Otavio Salvador; +Cc: U-Boot Mailing List

On Fri, 7 Jan 2022 at 16:16, Brian Norris <briannorris@chromium.org> wrote:
>
> 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>
> ---
>
>  tools/patman/gitutil.py | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

+Otavio Salvador to check this one

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] patman: Support absolute and ~user-relative alias files
  2022-01-12 21:21 ` Simon Glass
@ 2022-01-13 12:03   ` Otavio Salvador
  2022-01-13 18:00   ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2022-01-13 12:03 UTC (permalink / raw)
  To: Simon Glass; +Cc: Brian Norris, Otavio Salvador, U-Boot Mailing List

Em qua., 12 de jan. de 2022 às 18:22, Simon Glass <sjg@chromium.org> escreveu:
> On Fri, 7 Jan 2022 at 16:16, Brian Norris <briannorris@chromium.org> wrote:
> >
> > 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>
> > ---
> >
> >  tools/patman/gitutil.py | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
>
> +Otavio Salvador to check this one
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Some use-case of mine.

Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] patman: Support absolute and ~user-relative alias files
  2022-01-12 21:21 ` Simon Glass
  2022-01-13 12:03   ` Otavio Salvador
@ 2022-01-13 18:00   ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-01-13 18:00 UTC (permalink / raw)
  To: Otavio Salvador
  Cc: Brian Norris, Otavio Salvador, U-Boot Mailing List, Simon Glass

Em qua., 12 de jan. de 2022 às 18:22, Simon Glass <sjg@chromium.org> escreveu:
> On Fri, 7 Jan 2022 at 16:16, Brian Norris <briannorris@chromium.org> wrote:
> >
> > 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>
> > ---
> >
> >  tools/patman/gitutil.py | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
>
> +Otavio Salvador to check this one
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Some use-case of mine.

Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-13 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 23:15 [PATCH] patman: Support absolute and ~user-relative alias files Brian Norris
2022-01-12 21:21 ` Simon Glass
2022-01-13 12:03   ` Otavio Salvador
2022-01-13 18:00   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.