Article View: linux.kernel.git
Article #625Re: [PATCH v2 1/3] var: add GIT_HOSTNAME
From: Junio C Hamano
Date: Thu, 15 Oct 2026 19:32
Date: Thu, 15 Oct 2026 19:32
40 lines
11434 bytes
11434 bytes
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.
Technical Details
Message-ID:
<xmqqjynin4iv.fsf@gitster.g>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72175-linux-kernel-git=dewy.ruReferences:
<20261012015846.2649843-1-bellacaselli20@gmail.com> <20261015105859.3184108-1-bellacaselli20@gmail.com> <20261015105859.3184108-2-bellacaselli20@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-72175-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 1/3] var: add GIT_HOSTNAME
Date: Thu, 15 Oct 2026 12:32:40 -0700
Organization: Usenet Network
Message-ID: <xmqqjynin4iv.fsf@gitster.g>
References: <20261012015846.2649843-1-bellacaselli20@gmail.com>
<20261015105859.3184108-1-bellacaselli20@gmail.com>
<20261015105859.3184108-2-bellacaselli20@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="2605117"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:c7xxnCjcjsJAlkO3B0CPqL6DS/o= sha256:zLyrD7Okm8nojI11e+1949VastQvrrmLB0NGRXtygdc=
sha1:on8eHzheSGYoHfHCNMipjo4GLfk= sha256:x7Rb7Xr87MO9ey+l7/I9BtLriUti2kyoAILUf8YP8do=
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 C692F1103B8; Thu, 15 Oct 2026 22:34:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.749
X-Spam-Status: No, score=-0.749 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, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, 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=pobox.com header.b=LM1HibyB; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=QQbpqVlI
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 KMBKGZKGBgnj;
Thu, 15 Oct 2026 22:34:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-72175-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id E5677110200; Thu, 15 Oct 2026 22:34:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id B64CB3E32B; Thu, 15 Oct 2026 19:32:49 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2654F4FE2F7;
Thu, 15 Oct 2026 19:32:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="LM1HibyB";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QQbpqVlI"
X-Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91B402E06ED
for <git@vger.kernel.org>; Thu, 15 Oct 2026 19:32:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792092764; cv=none; b=RlXTqKjjbyk1lVA3TD2LMYVHGXjSbBn9zBPiigU8XMLhN3HWK5wfhG09scCOdj9P3HA6pDmQBHDtWrHncOtKnRCIT22Xf/KI5iazTYAd2zD6toaOhdYniKtbbdwOmz1Y88yHlLDe8/2xfIIpZDXMNlF4LXYhGv1ZhG2fAqWiaCI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792092764; c=relaxed/simple;
bh=yh28FOgsepMmBm0BNAw9BOOH9Yr4MMZqZjzHCUG3wrU=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=C8wFiDV+ampU1Jf6KYwefd87/QzKxvlFGcWiHeIiINRIxXE7EXduPHB1O3X2tQtNjJUKUX7WaGzKMVketMMl4uK9a3roQ/CovoJe2QZ2Zr3D0LV4DK3wJgtN1+4pGuQ4HaEZTdRNy/1gVIVK6C7Yc2b3nY//DCcwik38BhLMON4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=LM1HibyB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=QQbpqVlI; arc=none smtp.client-ip=202.12.124.148
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
by mailfout.stl.internal (Postfix) with ESMTP id D48891D000FE
for <git@vger.kernel.org>; Thu, 15 Oct 2026 15:32:42 -0400 (EDT)
X-Received: from phl-frontend-02 ([10.202.2.161])
by phl-compute-05.internal (MEProxy); Thu, 15 Oct 2026 15:32:42 -0400
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc
:cc:content-type:content-type:date:date:from:from:in-reply-to
:in-reply-to:message-id:mime-version:references:reply-to:subject
:subject:to:to; s=fm1; t=1792092762; x=1792179162; bh=TEHVvLyIzd
9wIjIdLTpSDUA6GFit/dhaK4G6M/okWOU=; b=LM1HibyBgJ/6VTBscSQU0xU8Km
n50riJzgc2MR9C7FofZlKmxtOvx/p8ZXuwrT/SHwLBq27tdBYHJn8sZHHtRU1hn5
bnZAVP4tmME/9qkppbqQRr+JZZQIChu1b9zF/WZgX6zidIXHA7RGiGkBsz16Olok
HsoInbJPRRNr4AX+uK9B3qku5K/QWnOB7ua96EUmFgCV4en2dONOP50mVm9rC2NA
nuAJ8XO6DlPHt8TAWdGK7KMfc09AmzeAb8npgQwd4963rA+JsbX4GIRxXy9DUYf1
MoCQn3JpWNryna655N7ug08blguAI88rdPUTkYJI66eFCn0NcN9pHfGbQ4Cw==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:subject:subject:to
:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
1792092762; x=1792179162; bh=TEHVvLyIzd9wIjIdLTpSDUA6GFit/dhaK4G
6M/okWOU=; b=QQbpqVlIreJ8xmWth6QN9anZfmbfoVh5+yxIVHc0dqJmVtPylMg
yg+sgAJ0FShfZjut09pNxYIP7s58E3Vt9OVdqV/SS7lYGOeCiff1LUdjGu7ApLsV
2nleVsa6lJ+Dik6IydDMdJGCKX6atZQrTFekY5WtW+9+gHBwoEq6cFOU1NBO68kR
cbFsZjvWeEweqiLQJ/DuR0H8CbWBCn2YB34jyWoyNsD7rePT39goxy4NXx4+nIwB
kWmnpUHxOM7CYcj3JR6BoMpMYJ7E1xWOLoXWZXYNBoWhlsrfPR2WRIVspw9wLrkC
hmaS93GXWq/cDBUeHxeKSl6S4H6UdU7d5Vg==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1792092762; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm1:rsa-sha256:evQ9tUP11d4mQ1jeE2n0PVaUf8ORQUEZVyxQjd8YK5FsubV
PylxXZg6NBaszVk8CiQknRre6sNrZYej1wQ3WUF3PJaDqKVw11tcZNO36SrOwL/C
bzo9M5mv1j9MTE1zTbU1ef2cafNjziHVjkuSVrLDrMuc1l/4YJBfePZL2BCB3N3v
ctuAe4nRb/BRtHYuWSkoVs9qOJWLxbptp5GlU7AwWbIvQQtoEltvVetOy8Zxcx38
K3syNf4q3+9rdJ7QtSeoxijPB1CjFBK4taRGNSKEhTrymN2awudagw9ztCbD7hhN
G9aj/Qyxgr7esJIDSHfu8HhVJ/XcMSK40u3/7aw==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:UwKpHyQFApZx3l249zHs54C8x+T0wJGCHjOMhZUk16I=:yh28FOgsepMmBm0BNAw9BOOH9Yr4MMZqZjzHCUG3wrU=;
X-ME-Sender: <xms:WirRaqAGpPTAycl608Uth_6zgkBO4c9U_vNA11S2O1_M8nSATqNyJg>
<xme:WirRaoPTu1obnlq0LJGP0OM6wfuf2Zvp3Jy15a-IsHlRtIEwzR43Pr1PaZm6BFw9h
QoASRZiOVOdUNdxZpq0u1DoKZ1ZbD-O4g2d5Nf2zhII4Lj6up4M_ygW>
X-ME-Received: <xmr:WirRanYbiEEgouVLii-m2_mYQ-nzHsQia9hCBSZp_Uyvn3QqBS4rY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iy9oxd>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
15 Oct 2026 15:32:41 -0400 (EDT)
X-Cc: git@vger.kernel.org, Jeff King <peff@peff.net>, Eric Sunshine
<sunshine@sunshineco.com>, Ignacio Encinas <ignacio@iencinas.com>
X-In-Reply-To: <20261015105859.3184108-2-bellacaselli20@gmail.com> (Isabella
Caselli's message of "Thu, 15 Oct 2026 07:58:57 -0300")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
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>