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

Re: Why does the includeif woks how it does?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2024, 01:42 UTC
Message-ID
<xmqqedd7ykq4.fsf@gitster.g>
In-Reply-To
<01d401da6379$635fdb30$2a1f9190$@nexbridge.com>
<rsbecker@nexbridge.com> writes:
> I have considered contributing an "includewhere" option that would
> do that and differentiate from "includeif". I'm not sure it is
> required, and what would happen with symbolic links.

Other potential gotchas would include how it interacts with directory hierarchies. You may be inside a directory /a/b (where none of /, /a, and /a/b is controlled by git) and want your "git init" invocation to be affected by some configuration included into your $HOME/.gitconfig via include-where mechanism. Would it work recursively? In other words, if you had

	[includeIf "gitdir:/a/b"] path = $HOME/gits/a-b-in-repo
	[includeIf "cwd:/"] path = $HOME/gits/others
	[includeIf "cwd:/a"] path = $HOME/gits/a
	[includeIf "cwd:/a/b"] path = $HOME/gits/a-b

would all of them be included? Just the last one? Does the most specific one win?

After your "git init" succeeds, the one specified with gitdir: would start kicking in. Would the "cwd:" ones that are meant for cases outside any directory under Git control be ignored then?

I am not opposed to such a feature existing at all; just pointing out there are sources of end-user confusion we need to be careful while we design the feature.

Previous: rsbecker@nexbridge.com
Message 4 of 4 in “Why does the includeif woks how it does?”
  1. Dominik von HallerFeb 18, 2024
  2. brian m. carlsonFeb 19, 2024
  3. rsbecker@nexbridge.comFeb 19, 2024
  4. Junio C HamanoFeb 20, 2024

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.