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

Effects of alias not changing the directory

From
LKLogan Kennelly <logank+git@sent.com>
Date
Mar 24, 2008, 05:27 UTC
Message-ID
<64DCCD62-D432-4076-9CD6-337EEB82FCCE@sent.com>

At the request of some of my coworkers, I created a wrapper script that allows them to use a graphical diff tool when they wish. I effectively add a new command through the use of an alias:

  [alias]
   exdiff = "!GIT_EXTERNAL_DIFF=git_exdiff.sh GIT_PAGER=cat git diff"

This command works extremely well when run by itself (`git exdiff`) but fails when run from a subdirectory and given a relative path because the alias machinery changes the current directory as demonstrated here:

  [alias]
   echopath = "!echo $PWD"
   $ cd /path/git_tracked/a/b
   $ git echopath
   /path/git_tracked

Is there a reason for this behavior? I'd like to submit a patch, but I'm concerned that I'm missing something. If it helps, I believe it is the setup_git_directory_gently logic (called from handle_alias) that results in the chdir.

Thank you.
Message 1 of 1 in “Effects of alias not changing the directory”
  1. Logan KennellyMar 24, 2008

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.