Re: [PATCH v3 0/2] Add hostname condition to includeIf
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 20, 2024, 02:49 UTC
- Message-ID
- <CAPig+cT9QxRZhZyZV=Txt1VfqzDZX=gDbXvFg1nO=rjeMFaBeQ@mail.gmail.com>
- In-Reply-To
- <20240320001934.GA903718@coredump.intra.peff.net>
On Tue, Mar 19, 2024 at 8:19 PM Jeff King <peff@peff.net> wrote:
Show 8 quoted lines
> On Tue, Mar 19, 2024 at 05:13:47PM -0400, Eric Sunshine wrote: > > The other possibility which came to mind was adding a GIT_HOSTNAME > > variable to the output of `git var -l`. > > That strikes me as a more appropriate spot than an option to git-config. > Even if config is the only thing _now_ which cares about the hostname, > it may be something that other parts of the system care about in the > future.
Also, taking into consideration Patrick's proposed revamp[1] of git-config to give it a subcommand API, then git-config becomes an even less welcome place for a standalone --show-hostname option which, by itself, doesn't really fit into the subcommand paradigm, and it probably doesn't make sense to add a new subcommand ("info" or whatever) just for that.
[1]: https://lore.kernel.org/git/cover.1710198711.git.ps@pks.im/T/#u
> Some care may need to be taken for error handling, though. For "git var > GIT_HOSTNAME" it is OK to exit non-zero, but "git var -l" should not > bail on a system where gethostname() doesn't work (it is still not clear > to me if that is a real case to worry about or not).
Ports to oddball platforms should probably be providing a gethostname() in "compat/" anyhow, just as is done for Windows in "compat/mingw.c".