Effects of alias not changing the directory
- From
- Logan 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.