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

Re: [PATCH] git-sh: Avoid sourcing scripts with git --exec-path

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 29, 2017, 04:21 UTC
Message-ID
<20170929042129.GA34269@aiede.mtv.corp.google.com>
In-Reply-To
<xmqqtvzmxij5.fsf@gitster.mtv.corp.google.com>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
Show 7 quoted lines
>> This has been broken for a while, but better late than never to
>> address it.
>
> I am not sure if this is broken in the first place.  We do want to
> make sure that the scripted porcelains will source the shell helper
> library from matching Git release.  The proposed patch goes directly
> against that and I do not see how it could be an improvement.

It used to be that git allowed setting a colon-separated list of paths in GIT_EXEC_PATH. (Very long ago, I relied on that feature.) If we can restore that functionality without too much cost, then I think it's worthwhile.

But the cost in this patch for that is pretty high.  And
	$ git log -S'$(git --exec-path)/'

tells me that colon-separated paths in GIT_EXEC_PATH did not work for some use cases as far back as 2006. Since 2008 the documentation has encouraged using "git --exec-path" in a way that does not work with colon-separated paths, too. I hadn't realized it was so long. Given that it hasn't been supported for more than ten years, I was wrong to read this as a bug report --- instead, it's a feature request.

In that context, this cost is likely not worth paying.

I wonder if there's another way to achieve this patch's goal. E.g. what if there were a way to specify some paths git could search for custom commands, separate from "git --exec-path"?

Putting the custom commands on the $PATH seems nicer unless you're trying to override the implementation of an existing git command. And we already discourage overriding the implementation of an existing git command (as it's open source, you can patch them instead), so...

Another possible motivation (the one that led me to use this mechnism long ago) is avoiding providing the dashed form git-$cmd in $PATH. I think time has shown that having git-$cmd in $PATH is not too painful.

Thanks and hope that helps, Jonathan

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “git-sh: Avoid sourcing scripts with git --exec-path”
  1. git-sh: Avoid sourcing scripts with git --exec-pathDridi Boukelmoune, Sep 28, 2017
  2. Jonathan NiederSep 29, 2017
  3. Junio C HamanoSep 29, 2017
  4. Jonathan NiederSep 29, 2017
  5. Junio C HamanoSep 29, 2017
  6. Dridi BoukelmouneSep 29, 2017

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.