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

Re: [PATCH v2 1/3] var: add GIT_HOSTNAME

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2026, 19:32 UTC
Message-ID
<xmqqjynin4iv.fsf@gitster.g>
In-Reply-To
<20261015105859.3184108-2-bellacaselli20@gmail.com>
Isabella Caselli <bellacaselli20@gmail.com> writes:
Show 35 quoted lines
> 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.
Previous: Isabella CaselliNext: Isabella Caselli
Message 18 of 20 in “hostname: includeIf condition — anyone already working on this?”
  1. Isabella CaselliSep 28, 2026
  2. Jeff KingSep 29, 2026
  3. Ignacio EncinasSep 29, 2026
  4. Jeff KingSep 29, 2026
  5. Junio C HamanoSep 29, 2026
  6. Isabella CaselliOct 2, 2026
  7. 0/3 Add hostname condition to includeIfIsabella Caselli, Oct 12, 2026
  8. 1/3 var: add GIT_HOSTNAMEIsabella Caselli, Oct 12, 2026
  9. 2/3 t6500: get hostname from "git var"Isabella Caselli, Oct 12, 2026
  10. Junio C HamanoOct 12, 2026
  11. Isabella CaselliOct 13, 2026
  12. Junio C HamanoOct 13, 2026
  13. 3/3 config: learn the "hostname:" includeIf conditionIsabella Caselli, Oct 12, 2026
  14. Junio C HamanoOct 12, 2026
  15. Jeff KingOct 14, 2026
  16. 0/3 Add hostname condition to includeIfIsabella Caselli, Oct 15, 2026
  17. 1/3 var: add GIT_HOSTNAMEIsabella Caselli, Oct 15, 2026
  18. Junio C HamanoOct 15, 2026
  19. 2/3 t6500: get hostname from "git var"Isabella Caselli, Oct 15, 2026
  20. 3/3 config: learn the "hostname:" includeIf conditionIsabella Caselli, Oct 15, 2026

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.