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

Re: git's directory is _prepended_ to PATH when called with an absolute path

From
David Rodríguez <deivid.rodriguez@gmail.com>
Date
Apr 22, 2015, 11:36 UTC
Message-ID
<553787A0.40707@gmail.com>
In-Reply-To
<20150422054737.GA11889@inner.h.apk.li>
On 22/04/15 02:47, Andreas Krey wrote:
Show 10 quoted lines
> On Tue, 21 Apr 2015 18:37:29 +0000, David Rodríguez wrote:
> ...
>> This causes issues with Ruby git hooks, because Ruby version managers
>> rely on custom settings in PATH to select the Ruby executable,
> Even if git wouldn't modify PATH this is still a broken way to do that.
> What ruby to execute a hook with is a property of the hook, not of the
> user context invoking it.
>
> Andreas
>

I probably shouldn't have mentioned Ruby version managers since they are not directly related to this issue. I'll try to elaborate on the issue:

* User is relying on a custom path to select their Ruby version. For 
example, let's say the first folder in path is "~/.rubies/2.2.2/bin".
* User runs "/usr/bin/git commit" and a pre-commit hook is triggered.
* The pre-commit hook starts with "#!/us/bin/env ruby" to select the 
Ruby to be used in the hook, but since the path has been changed by 
"/usr/bin/git", the selected ruby will be "/usr/bin/ruby" and not 
"~/.rubies/2.2.2/bin/ruby" as the user would expect.

What's the proper way to do whatever you're saying is done in "a broken way"?

Previous: Andreas KreyNext: Andreas Krey
Message 6 of 9 in “git's directory is _prepended_ to PATH when called with an absolute path”
  1. David RodríguezApr 21, 2015
  2. Junio C HamanoApr 21, 2015
  3. David RodríguezApr 21, 2015
  4. David RodríguezApr 21, 2015
  5. Andreas KreyApr 22, 2015
  6. David RodríguezApr 22, 2015
  7. Andreas KreyApr 22, 2015
  8. brian m. carlsonApr 22, 2015
  9. David RodríguezApr 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.