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

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

Previous: Jeff KingNext: Jeff King
Message 11 of 12 in “PATH modifications for git-hook processes”
  1. Matthew RothenbergApr 14, 2015
  2. Junio C HamanoApr 14, 2015
  3. Matthew RothenbergApr 15, 2015
  4. Jeff KingApr 16, 2015
  5. Jeff KingApr 16, 2015
  6. David RodríguezApr 22, 2015
  7. Junio C HamanoApr 22, 2015
  8. stop putting argv[0] dirname at front of PATHJeff King, Apr 22, 2015
  9. Eric SunshineApr 22, 2015
  10. Jeff KingApr 22, 2015
  11. Jonathan NiederApr 22, 2015
  12. Jeff KingApr 22, 2015

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.