From: Isabella Caselli <bellacaselli20@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Eric Sunshine <sunshine@sunshineco.com>,
Ignacio Encinas <ignacio@iencinas.com>,
Isabella Caselli <bellacaselli20@gmail.com>
Subject: [PATCH v2 0/3] Add hostname condition to includeIf
Date: Thu, 15 Oct 2026 07:58:56 -0300 [thread overview]
Message-ID: <20261015105859.3184108-1-bellacaselli20@gmail.com> (raw)
In-Reply-To: <20261012015846.2649843-1-bellacaselli20@gmail.com>
This series adds a "hostname:" condition to includeIf, allowing a
configuration file to be included only on machines whose hostname
matches a pattern. It also adds GIT_HOSTNAME to "git var", so users
can see which hostname Git uses for matching.
Changes since v1 [1]:
- Rewrite the commit message of patch 2 to explain what the test
no longer verifies when the hostnames differ, as Junio asked.
[1] https://lore.kernel.org/git/20261012015846.2649843-1-bellacaselli20@gmail.com/
Isabella Caselli (3):
var: add GIT_HOSTNAME
t6500: get hostname from "git var"
config: learn the "hostname:" includeIf condition
Documentation/config.adoc | 14 ++++++++++++
Documentation/git-var.adoc | 5 +++++
builtin/var.c | 13 +++++++++++
config.c | 17 +++++++++++++++
t/t0007-git-var.sh | 5 +++++
t/t1305-config-include.sh | 44 ++++++++++++++++++++++++++++++++++++++
t/t6500-gc.sh | 2 +-
7 files changed, 99 insertions(+), 1 deletion(-)
Range-diff against v1:
1: a34e1eb36f = 1: 7609601553 var: add GIT_HOSTNAME
2: c341ae75c0 ! 2: cb1599c7ce t6500: get hostname from "git var"
@@ Commit message
It gets the hostname from the "hostname" command, falling back to
"unknown" if the command fails.
- "git gc" gets its hostname from the system and only checks whether the
- pid is alive if the two hostnames match. Otherwise, it assumes the
- lock belongs to a gc running on another machine. Since the test passes
- in either case, a missing "hostname" command or a mismatch between
- its output and the system hostname can cause the test to silently
- exercise the wrong case.
+ "git gc" only checks whether the pid in "gc.pid" is alive if the
+ recorded hostname matches its own. If the hostnames differ, it assumes
+ the lock belongs to a gc running on another machine and skips the pid
+ check. Since the test passes in either case, it may pass without
+ checking whether "git gc" detects a running process on the same
+ machine.
Use "git var GIT_HOSTNAME" to get the same hostname as "git gc".
- Keep the "unknown" fallback, which is also used by "git gc" when it
- cannot determine the hostname.
+ Keep the "unknown" fallback, which "git gc" also uses when it cannot
+ determine the hostname.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Isabella Caselli <bellacaselli20@gmail.com>
3: a1e4fc5ba3 = 3: 5a2bb2172a config: learn the "hostname:" includeIf condition
base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
--
2.43.0
next prev parent reply other threads:[~2026-10-15 11:00 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 ` Isabella Caselli [this message]
2026-10-15 10:58 ` [PATCH v2 1/3] var: add GIT_HOSTNAME Isabella Caselli
2026-10-15 19:32 ` Junio C Hamano
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=20261015105859.3184108-1-bellacaselli20@gmail.com \
--to=bellacaselli20@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.