Article View: linux.kernel.git
Article #295[PATCH 0/3] Add hostname condition to includeIf
From: Isabella Caselli
Date: Mon, 12 Oct 2026 01:58
Date: Mon, 12 Oct 2026 01:58
64 lines
10239 bytes
10239 bytes
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
Technical Details
Message-ID:
<20261012015846.2649843-1-bellacaselli20@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-71721-linux-kernel-git=dewy.ruReferences:
<CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-71721-linux-kernel-git=dewy.ru
From: bellacaselli20@gmail.com (Isabella Caselli)
Newsgroups: linux.kernel.git
Subject: [PATCH 0/3] Add hostname condition to includeIf
Date: Sun, 11 Oct 2026 22:58:43 -0300
Organization: Usenet Network
Message-ID: <20261012015846.2649843-1-bellacaselli20@gmail.com>
References: <CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1661145"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0wNOsJKPYIilEUhGi/F5HnJ5cfQ= sha256:CfmOyEjpEnMUHbo1VFwFJag3vjEifHrBRavpFxY93yM=
sha1:n6/S5eqAQQEH4wUG5FcSE0YWbIQ= sha256:zmtoIytkHDk1D7m2xJDEyYZRpX+u/i8kiDuttRCUJXU=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 4A6C910FAB9; Mon, 12 Oct 2026 05:01:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 3TzFB0fCP0ze;
Mon, 12 Oct 2026 05:01:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-71721-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 774EA10CC20; Mon, 12 Oct 2026 05:01:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 7E8BE3269A; Mon, 12 Oct 2026 02:01:06 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A7643372EEA;
Mon, 12 Oct 2026 02:01:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nddQmsU8"
X-Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 913C822D4E9
for <git@vger.kernel.org>; Mon, 12 Oct 2026 02:01:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791770464; cv=none; b=KK3qzkT3jAG2Q1SyqHQk9qKNm5nake4WkJnFFuIwruzu45mFsYt9eNa9+TJ4g6GkakCXQ5STY6Tpf9avX8uI15TLaYBys1TyDkdAlmLfAibcUPCQJm48T5d8BGoWh/SYnl+ht63Eu3sXbQlcxZAXM9GSUf8dLbDqUBYwX7Q5A+o=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791770464; c=relaxed/simple;
bh=N9AwabC1yaPLVGHiINDt5Allkvyy6dNsCReZ9LQn7ms=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=fBQSu+4G2R8KAllav090HA2JVAFpMiThyJ7SJx6VoEf1AJXoA1IZRWfg/p8+dLSoq9EhqzjYBsZY8iTtKqa+cy/7tuffTWk+ySAEg1icOAwHWP35MeRq3JF/H2qdbOPi6QZ6XdLcYKpe0VcsejdSuC1vveXE1zioyzL2l6yOncU=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nddQmsU8; arc=none smtp.client-ip=74.125.82.172
X-Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-3282db206d3so1684909eec.0
for <git@vger.kernel.org>; Sun, 11 Oct 2026 19:01:03 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1791770462; x=1792375262; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=2IaIIxRHk6r1fUfrKmfH4dAmtAxZ2cBP85R+I+TX6LM=;
b=nddQmsU8Rf7hAmN/2o/DNf0CeSWyRc7eUml24qiBUXCpfj2FP/HVnX9hElE0MtPv6m
Z9d3a+yDYwdMi8T4nuQP4uRul4hdl94Oj+VySOAe9HDriL9GOXklt4ih6GOaYLQMzkID
mZcqnmk31MOtOkWq1ca2PHZi1O34WVrtKVKh+zWKvkX/Ci9kypeaLt9dIlqq4NJ7g02J
nuH873jdhhdIBEsrOyxqpJ09wm0+889WBp49xIUUlYci6FjicOQr54gtjlPLfiiyIu4k
qAnEzBMT5/aiEOflzioEfFGj6ImWFm2nRhdr8OXUYvTevpyhj6zZGqN652QnttAzn9EX
hl0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1791770462; x=1792375262;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=2IaIIxRHk6r1fUfrKmfH4dAmtAxZ2cBP85R+I+TX6LM=;
b=Kt/OTDapx2zT99/QZPrI/BcB8H1OdTFiSz1oeUmGp9W97dJhtXh7ciWLzqpDrHFrp4
n9hKEITSer8t6ADNjVwDJpY7jpiaMvM17RP5IgzByhRHvMxVH80Z7vFK7e30nb7Yggur
lEJ4o3h0moAUZ6aNyeHKvg5yOWgdxI/lqU8dVBFDQSfWxA2qQnbIYfzPZlYmqJarIVo4
JfbowlYAVXCO4uXWSk3ZrWxIkQf9gZSJvFFq0daxrMIXSVVz04qrqqKQzTuZWUa4gdPP
CRanADH8Yd56/TdTW7WUhDNCwrOWP7PKBldu/0jFypVC4yCLGN4kPLb58ldYAF9xUwaS
s4hw==
X-Gm-Message-State: AFq9FYItrcNswtaKsh9HpSoLdSrAtfKGMkCbe8s4pvBtrKCm8Lmryw2v
z+CagBJzaitsDp1yIXshP7XOxvfPlwmPfUUAzBobjMklWpkqoBocj9x6lIcLzHKozUY=
X-Gm-Gg: AYBFou0uknDsR+/PFzx79GtMqBi9GEecXMzdm8yMBZPP2JYAQOb+quU3dWM1ZMTJJVa
J8TlwFr+nC4Y1yKY3/K0Pe6doWsQfYcMvRqshQVnYnVveJT+VBTfyjoBL+MzjU4oO+/18C3+JKy
haUZ3ADPxfPWFm4Pq+Zz09sFeeAIb8g+Be/r66pGVa+yHSITLq6K9JGAbJHBzejha7TEz4M0Aou
4MkDKPeiOxPwnZfjLEKvFpa83bzfSkNcz5zYBdLe2OHdv5/QtFTRaJtOp350tpGxQtxxCnskYYw
SzIN+Aeb06pimkYYtQGr8QxcFDSyH4mNd6gu/3fT+Lqd3X+QQlFoB1PzO0cy3FN9IVlR1Ye3YW4
Cnjf1O8snbNIoD2gsShisSyRV9bO0MUDOcIDoDfRmegpdwtZ7WiiKuMqYP10kjVr0tBxLlguywE
f3f6h0MraWHroj68E+vTofbCd8wNbIlfd8emTE6nAoryVC/sBD3wqJwIIu8oEWfbyVhRLvdXITV
ytCcT2P65WrJNRuJKrPJMXL1nvPpMr1
X-Received: by 2002:a05:7022:3f0c:b0:151:2e62:fe8d with SMTP id a92af1059eb24-16a5dcf817bmr12527077c88.9.1791770462354;
Sun, 11 Oct 2026 19:01:02 -0700 (PDT)
X-Received: from isabella-caselli-linux.. ([2804:14c:9e:81ad:adb8:bc9f:a8c8:3c2d])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-35a352d4b05sm7196412eec.19.2026.10.11.19.01.00
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 11 Oct 2026 19:01:02 -0700 (PDT)
X-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>
X-Mailer: git-send-email 2.43.0
X-In-Reply-To: <CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.gmail.com>
X-Precedence: bulk
X-Mailing-List: git@vger.kernel.org
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>