Re: [PATCH] stop putting argv[0] dirname at front of PATH
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 22, 2015, 19:23 UTC
- Message-ID
- <20150422192317.GI5467@google.com>
- In-Reply-To
- <20150422181402.GB3535@peff.net>
Hi,
Jeff King wrote:
Show 13 quoted lines
> This was added long > ago by by 231af83 (Teach the "git" command to handle some > commands internally, 2006-02-26), with the intent that > things would just work if you did something like: > > cd /opt > tar xzf premade-git-package.tar.gz > alias git=/opt/git/bin/git > > as we would then find all of the related external commands > in /opt/git/bin. I.e., it made git runtime-relocatable, > since at the time of 231af83, we installed all of the git > commands into $(bindir).
[...]
> And > not just for finding binaries; we want to find $(sharedir), > etc, the same way. The RUNTIME_PREFIX build knob does this > the right way
Makes sense. For the reason you say (templatedir, etc) I am surprised to hear that that was the motivation, but I can't find any other.
[...]
> Signed-off-by: Jeff King <peff@peff.net>
For what it's worth, Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
[...]
Show 5 quoted lines
> But note that you can't just > flip on RUNTIME_PREFIX on non-Windows systems, as some invocations will > get the full path to the executable, and others see just "git". You'd > need to convert that into an absolute path (either by searching the > $PATH, or doing something system-specific like looking in /proc/$$/exe).
Yep --- /proc/self/exe should work okay if someone wants "portable git" to work on Linux.
Thanks, Jonathan