From: Junio C Hamano <gitster@pobox.com>
To: Isabella Caselli <bellacaselli20@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Eric Sunshine <sunshine@sunshineco.com>,
Ignacio Encinas <ignacio@iencinas.com>
Subject: Re: [PATCH v2 1/3] var: add GIT_HOSTNAME
Date: Thu, 15 Oct 2026 12:32:40 -0700 [thread overview]
Message-ID: <xmqqjynin4iv.fsf@gitster.g> (raw)
In-Reply-To: <20261015105859.3184108-2-bellacaselli20@gmail.com> (Isabella Caselli's message of "Thu, 15 Oct 2026 07:58:57 -0300")
Isabella Caselli <bellacaselli20@gmail.com> writes:
> Git asks the system for the name of the machine it runs on in a few
> places. For example, "git gc" records it in "gc.pid" to tell whether
> the gc holding the lock runs on the same machine. Users have no way
> to see which name Git uses, and depending on how the system is
> configured, it may be a short name ("myhost") or a fully qualified
> one ("myhost.example.com").
>
> This matters more once the config can depend on the hostname, which
> a later commit adds as an includeIf condition. Without a way to see
> the value Git uses, users would have to guess what to write in their
> config file.
>
> Add a GIT_HOSTNAME variable to "git var" that prints the hostname
> Git sees. If the hostname can't be determined, "git var GIT_HOSTNAME"
> exits with a non-zero status, and "git var -l" omits the variable
> instead of failing.
>
> An option to "git config" to show the hostname was also discussed,
> but "git var" was chosen, since the hostname is not specific to
> the configuration code.
>
> The test only checks that a non-empty value is printed. The test has
> no independent way to know the expected hostname, as the "hostname"
> command may not agree with what Git sees on every platform. The
> includeIf tests added later check that the value matches what the
> configuration code uses.
>
> Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
> Suggested-by: Jeff King <peff@peff.net>
> Signed-off-by: Isabella Caselli <bellacaselli20@gmail.com>
> ---
> Documentation/git-var.adoc | 3 +++
> builtin/var.c | 13 +++++++++++++
> t/t0007-git-var.sh | 5 +++++
> 3 files changed, 21 insertions(+)
Nicely written, and the implementation looks sensible.
next prev parent reply other threads:[~2026-10-15 19:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 23:43 hostname: includeIf condition — anyone already working on this? Isabella Caselli
2026-09-29 1:44 ` Jeff King
2026-09-29 12:14 ` Ignacio Encinas
2026-09-29 18:28 ` Jeff King
2026-09-29 19:55 ` Junio C Hamano
2026-10-02 1:52 ` Isabella Caselli
2026-10-12 1:58 ` [PATCH 0/3] Add hostname condition to includeIf Isabella Caselli
2026-10-12 1:58 ` [PATCH 1/3] var: add GIT_HOSTNAME Isabella Caselli
2026-10-12 1:58 ` [PATCH 2/3] t6500: get hostname from "git var" Isabella Caselli
2026-10-12 19:20 ` Junio C Hamano
2026-10-13 1:14 ` Isabella Caselli
2026-10-13 1:43 ` Junio C Hamano
2026-10-12 1:58 ` [PATCH 3/3] config: learn the "hostname:" includeIf condition Isabella Caselli
2026-10-12 19:24 ` Junio C Hamano
2026-10-14 10:31 ` [PATCH 0/3] Add hostname condition to includeIf Jeff King
2026-10-15 10:58 ` [PATCH v2 " Isabella Caselli
2026-10-15 10:58 ` [PATCH v2 1/3] var: add GIT_HOSTNAME Isabella Caselli
2026-10-15 19:32 ` Junio C Hamano [this message]
2026-10-15 10:58 ` [PATCH v2 2/3] t6500: get hostname from "git var" Isabella Caselli
2026-10-15 10:58 ` [PATCH v2 3/3] config: learn the "hostname:" includeIf condition Isabella Caselli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqjynin4iv.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bellacaselli20@gmail.com \
--cc=git@vger.kernel.org \
--cc=ignacio@iencinas.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox