git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Set GIT_PATHNAME_PREFIX with aliases.

From
Jeff King <peff@peff.net>
Date
May 5, 2010, 07:01 UTC
Message-ID
<20100505070131.GA11265@coredump.intra.peff.net>
In-Reply-To
<4BE115EF.8010306@viscovery.net>
On Wed, May 05, 2010 at 08:53:35AM +0200, Johannes Sixt wrote:
Show 13 quoted lines
> Am 5/5/2010 2:51, schrieb Jeff King:
> > On Tue, May 04, 2010 at 08:25:22PM -0400, Jared Hance wrote:
> > 
> >> The environment variable GIT_PATHNAME_PREFIX passes on the
> >> current working directory (where the git command was called from)
> >> to shell aliases (aliases that begin with "!"). This allows these
> >> shell aliases to know the directory that the git command was called
> >> from.
> > 
> > Seems like a reasonable goal, but...
> 
> Sorry, I disagree.
> [reasons why it sucks]

Yes, I agree it sucks. The problem is that this information is totally lost now for shell aliases, so you can't even do these painful things. Your alias simply doesn't have access to that information at all. I am open to better interfaces (my "reasonable" above was not a ringing endorsement, but rather "I can see why you might want to do this").

> The only way where this variable could be used in a useful manner is to
> write the alias as
> 
>    !cd "${GIT_PATHNAME_PREFIX:-.}" && { do stuff... ; }
Agreed that is the only sane thing to do with it, but...
> which is something that git should do before it invokes the alias.

Wouldn't we then be breaking existing aliases which do not expect this new behavior?

-Peff
Previous: Johannes SixtNext: Eli Barzilay
Message 4 of 23 in “Set GIT_PATHNAME_PREFIX with aliases.”
  1. Set GIT_PATHNAME_PREFIX with aliases.Jared Hance, May 5, 2010
  2. Jeff KingMay 5, 2010
  3. Johannes SixtMay 5, 2010
  4. Jeff KingMay 5, 2010
  5. Eli BarzilayMay 5, 2010
  6. Junio C HamanoMay 5, 2010
  7. An alias that starts with "!!" runs in the current directory.Eli Barzilay, May 5, 2010
  8. Jared HanceMay 5, 2010
  9. Eli BarzilayMay 5, 2010
  10. Eli BarzilayMay 5, 2010
  11. Re-submitting patchesJonathan Nieder, May 5, 2010
  12. Eli BarzilayMay 5, 2010
  13. An alias that starts with "!!" runs in the current directory.Eli Barzilay, May 5, 2010
  14. Will PalmerMay 5, 2010
  15. Eli BarzilayMay 5, 2010
  16. Junio C HamanoMay 5, 2010
  17. Adam BrewsterMay 6, 2010
  18. Will PalmerMay 6, 2010
  19. Will PalmerMay 6, 2010
  20. Johannes SixtMay 6, 2010
  21. Matthieu MoyMay 6, 2010
  22. Junio C HamanoMay 5, 2010
  23. Eli BarzilayMay 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.