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 0/3] Add hostname condition to includeIf
Date: Sun, 11 Oct 2026 22:58:43 -0300 [thread overview]
Message-ID: <20261012015846.2649843-1-bellacaselli20@gmail.com> (raw)
In-Reply-To: <CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.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.
The series is based on Ignacio Encinas's v3 from March 2024 [1].
Ignacio dropped the series and agreed to let me give it a try,
so I am sending it as a new series.
The "hostname:" patch retains his work and credits him with
Based-on-patch-by.
Changes since Ignacio's v3:
- Drop "test-tool xgethostname". Eric pointed out that exposing the
hostname to users would make the helper unnecessary, and suggested
adding GIT_HOSTNAME to "git var", which I agree is the best way to
make this information available to users. Patch 1 adds it, and the
tests use it instead of the helper.
- Make "git var -l" omit GIT_HOSTNAME when the hostname cannot be
determined, rather than failing, as Jeff suggested.
- Make t6500 use "git var GIT_HOSTNAME || echo unknown", as Jeff
suggested and Junio agreed.
- Document that the hostname may be short or fully qualified, using
Jeff's proposed wording, and point to "git var GIT_HOSTNAME"
instead of gethostname(2), which Eric noted would not be helpful
to users.
- Use xmemdupz() in include_by_hostname(), as Jeff suggested.
- In t1305, read the hostname into a variable before each
here-document, so that failures are not silently ignored, as
Junio pointed out.
One open question is case sensitivity. Matching is case-sensitive,
like "onbranch:", so "hostname:MyHost" would not match a machine that
reports "myhost", even though DNS names are case-insensitive. Keeping
it case-sensitive seems reasonable to me, but I was not sure. Should
it stay as is, ignore case, or have a "hostname/i:" variant, like
"gitdir/i:"?
[1] https://lore.kernel.org/git/20240319183722.211300-1-ignacio@iencinas.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(-)
base-commit: 5a7d1e8045ce66c908f62598e26cbb8df7b39a90
--
2.43.0
next prev parent reply other threads:[~2026-10-12 2:01 UTC|newest]
Thread overview: 14+ 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 ` Isabella Caselli [this message]
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
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=20261012015846.2649843-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.