🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #862

[PATCH] init: show absolute path of (re)initialized repository

#862
From: Matt Hunter
Date: Tue, 20 Oct 2026 05:38
60 lines
9778 bytes
Since 20e38cba3926 (setup: split up concerns of `init_db()`,
2026-09-10), git-init produces the message:

    Initialized empty Git repository in .git/

instead of the previous

    Initialized empty Git repository in /full/path/to/repo/.git/

Prior to 20e38cba3926, the code producing this message was in function
init_db (renamed at the time to create_repository).  In that context,
the git_dir variable was updated by 'git_dir = repo_get_git_dir(repo);'
earlier in the function, to set the value used in printf.

None of the discussion [1] around the original patch indicates that this
change was intentional, so address the regression by similarly using
repo_get_git_dir in this code's new location.

In this case, git_dir is referencing owned memory that is later freed,
so declare a new variable to hold the used string.

1: https://lore.kernel.org/git/20260825-pks-odb-write-alternates-at-creation-time-v1-0-911513ba95c3@pks.im/

Signed-off-by: Matt Hunter <m@lfurio.us>
---
 builtin/init-db.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 374ed3a74706..a2628568ff6a 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -248,18 +248,19 @@ int cmd_init_db(int argc,
 	create_object_database(the_repository, NULL);
 
 	if (!quiet) {
-		int len = strlen(git_dir);
+		const char *full_git_dir = repo_get_git_dir(the_repository);
+		int len = strlen(full_git_dir);
 
 		if (reinit)
 			printf(repo_settings_get_shared_repository(the_repository)
 			       ? _("Reinitialized existing shared Git repository in %s%s\n")
 			       : _("Reinitialized existing Git repository in %s%s\n"),
-			       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
+			       full_git_dir, len && full_git_dir[len-1] != '/' ? "/" : "");
 		else
 			printf(repo_settings_get_shared_repository(the_repository)
 			       ? _("Initialized empty shared Git repository in %s%s\n")
 			       : _("Initialized empty Git repository in %s%s\n"),
-			       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
+			       full_git_dir, len && full_git_dir[len-1] != '/' ? "/" : "");
 	}
 
 	free(template_dir_to_free);

base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb
-- 
2.56.0.257.gf7497c7d27
Technical Details
Message-ID: <20261020053932.1274210-1-m@lfurio.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72482-linux-kernel-git=dewy.ru

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-72482-linux-kernel-git=dewy.ru
From: m@lfurio.us (Matt Hunter)
Newsgroups: linux.kernel.git
Subject: [PATCH] init: show absolute path of (re)initialized repository
Date: Tue, 20 Oct 2026 01:38:47 -0400
Organization: Usenet Network
Message-ID: <20261020053932.1274210-1-m@lfurio.us>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3789243"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:guuAokvqblakaBomgjUllEiaFco= sha256:Q8MtkDCRDHdOS3YnhtcN3tqcVjpRQvjWoTnhGFYzXMw=
	sha1:UKmSVCZJ61nGc76xSP3ASlYstPc= sha256:Z1uMFF8rReO662GAOzsEAq6+i3/yUu+G/6VZDuy47sQ=
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 B88DB110C03; Tue, 20 Oct 2026 08:40:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lfurio.us
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 ShqzrxOC5wPG;
	Tue, 20 Oct 2026 08:40:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-72482-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lfurio.us
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id CC1A3110B39; Tue, 20 Oct 2026 08:40:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id A9F953A809; Tue, 20 Oct 2026 05:40:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792474817;
	b=K4s/zT/wegT4tBYh1FUNrsls756zVdRbu83wj7Xk0FXlM6pqGWsWbvrWL0B6LqZZL/jY
	 ta34s2IXUIH6H1ggNpUiZp7LJ4NX/6DmR8oC3U/cs6yexeYxpEFnxR+jiuiTV7hMh71sf
	 oLDR4LgGbUGviv3LA5uA7Pg9TExYOUhMaSsWG5coAZhBk6QP4vpo6llCqR+SARRsNNc0x
	 subyEKsK9b+yyMGzpUpq2FuWI/0T5TSbA2y9xNShO91+gHp96ZvLa6aXpNuGxtIgFDzHU
	 8qf4uaxwGKC73yRvzf5UKFfmXQqS2WOgUCN6Wz4VevW1gUppa1KKJD81+ce+WCk0yKw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792474817;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=2+S4poIuayLx8Xg6sBzNCoLOXBtlyYETIxKNzfrSpXk=;
	b=SjlQi6FfijBWTbV4EocRKEIqJEUe6nisoz7qqf58ojT/pbQN9EgIcfoAZGE0UCr8irXz
	 rg68Ca87NqSsKniuvlKw0Rg2mZoYzL0pB6XOq/v4zGg69l49g5CIjWXKylOKzI9yXVC5n
	 izz+G4Ut95NL9n/usViRqCtQo253UQB+Zuki2wp4V3ZLA2xOZmaq01gAxS/rXWWnCLPFR
	 ADtXPMDPTXhBg89XEgBrUxlmDjMBf3JxjY8F2tlPqrZlIGEo35cCM4alOhVGvZUy0+cUn
	 V41iU+yoY4g2YoRs8f7aso0L/0qMWpf8F9KZ3AWzFPX5Xp2AVzZlU5bjxp6/SaPEnWQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b=ewMeR7Xb;
	dmarc=pass header.from=lfurio.us;
	spf=pass smtp.mailfrom=lfurio.us;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id BAE33606A31F;
	Tue, 20 Oct 2026 05:40:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b=ewMeR7Xb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=157.230.60.252
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792474816;
	b=h7yF+Fmty/1VXIxm5wQ9k5/kTfoLIjRbfmhLrukFN1Uxpsm863FJmenRalg8nAE+6Klx
	 jSaqO2UMyGDVyMOsbEVDMkGlJFn25rvp679aGX5yGRo0BqSUxMtjdn7p8Dp73/0VCa+D9
	 MUNnHTe5CMQGvuE60BLlWU+VLo6ryOSkNvLf8OUgHlNSlDUOqygJ6qd8eaILFe15kbYFl
	 pBvX23L/5KdJw7HkRtaBEUZZHUdZPP/SUl+xeEhBn3v8nA1ZWD3F24buqQtSbNMqwo1Lc
	 egG4nVAyo2LCHpUK7aIn7T7ldt1Vev5VF0LcOvC4TuHJSW7+K3/WgmgjmRb8dZZdQXw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792474816;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=2+S4poIuayLx8Xg6sBzNCoLOXBtlyYETIxKNzfrSpXk=;
	b=Rmuz6kCh1LZgh8wJKvsIDyK6WwYw4vxxguvNz0AP1WamLpK1ozTN/JeTMwLcBfm5hF4y
	 PT+eAoQ8UodDZCl8mqrdo0zOYMBAC03rEWHEontoP3ChuEGgbzanjvscoThnvWKErWeLK
	 2ESsOv4+kvpMN9107QdwXjf8jDILe9+AizQ6R+V3crmxdH586ABmaTyFq99Lv32SsLZz2
	 eYCNwqMr+qVb5jDVG9C6NKkLm7otSjrdvoYpCGxRA1e9uXn2YUBN0d+1sQu00WH7C8F+r
	 ua9Gch4eHWoXvDcWW3pUNfu52IkTYhmAnjvtnTcBo/SxfIwSJFuskfr2lwF3PES0Rhw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lfurio.us;
	spf=pass smtp.mailfrom=lfurio.us;
	dkim=pass header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b=ewMeR7Xb;
	arc=none smtp.remote-ip=157.230.60.252
X-Received: from mail.normalmode.org (h01.normalmode.org [157.230.60.252])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33965606A319
	for <git@vger.kernel.org>; Tue, 20 Oct 2026 05:40:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 33965606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lfurio.us
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lfurio.us
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lfurio.us; s=default;
	t=1792474815; bh=MvleDe6J10sa5Me7hsE5f6tB6QXqzWK6Y7ZRttzHsKY=;
	h=From:To:Cc:Subject:Date:From;
	b=ewMeR7XbggIYSxu2upU+n/IjwoeUurIsHRgL9DSUjZaQBMVw7raMCugH4lt3vaaAJ
	 TZWg2JQRU5X+L9yLNX2AvThz/ljnnvhd29dDyx+bJCtAk9g0Fy/DvQuw0g3aOs9LAZ
	 nLKx8ldRJNR2Tbd0CG6ARpQhXyYxM9jcbYyJHepM=
X-Received: by mail.normalmode.org (Postfix) with ESMTPSA id E9B3E6225B;
	Tue, 20 Oct 2026 05:40:14 +0000 (UTC)
X-Cc: Patrick Steinhardt <ps@pks.im>
X-Mailer: git-send-email 2.56.0.257.gf7497c7d27
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list