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

Re: Shell aliases & paths

From
Eli Barzilay <eli@barzilay.org>
Date
May 4, 2010, 21:22 UTC
Message-ID
<19424.36914.867693.327548@winooski.ccs.neu.edu>
In-Reply-To
<20100504211122.GA15091@progeny.tock>
On May  4, Jonathan Nieder wrote:
Show 11 quoted lines
> Eli Barzilay wrote:
> 
> > AFAICT, a shell command alias (one that starts with a "!") is
> > executed from the repository root, but to make things worse it
> > looks like there is no way to tell which directory it was executed
> > from.  If this is correct, then these aliases are useless for
> > anything that need to accept relative paths.  Is there something
> > obvious that I'm missing?
> 
> Not that I can see.  Maybe a new GIT_PATHNAME_PREFIX environment
> variable would help.

Yeah, I was searching the environment for something like that, and was surprised when I didn't find any shred of the original path in there. (In any case, I'd like to see something like that, although it's too late for me to use it since I need a solution that works now...)

Show 5 quoted lines
> If we were starting from scratch, it might be nice to make aliases
> suppress the chdir to toplevel.  Unfortunately, that would probably
> break some existing aliases.  Another possibility would be to use
> some alternative convention (like [alias] foo = "# bar") to suppress
> the repository search.
> At that point, why not just add a git-foo script to $PATH?  (‘git
> foo’ will still call it.)
The same can be said on all shell aliases, no?

FWIW, I find these aliases more convenient in having "extensions" work for other people -- ie, it's easier to say "here's some text, dump it in your ~/.gitconfig" than it is to explain where some script should be added and how ("put the text in a git-foo file, make sure to chmod +x it, put that in your $PATH, you do have your own bin directory, right?").

(But the disclaimer here is that I have a very narrow point of view.)
-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 5 in “Shell aliases & paths”
  1. Eli BarzilayMay 4, 2010
  2. Jonathan NiederMay 4, 2010
  3. Eli BarzilayMay 4, 2010
  4. Jonathan NiederMay 4, 2010
  5. Eli BarzilayMay 4, 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.