From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (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 826A13F105D for ; Thu, 27 Aug 2026 21:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787866745; cv=none; b=A74rTB93bvZSNRYWF94j2Ng3nDOPIHfv+H2O6iCPk2p5soi4EajxNe0GqynGonOpqoMRXIt51Xa8rmM7eRSvKq50NfmhtaKvJU/G9EsV08/R37sb5xXcRBNAbdzqtn341y3d9WW4odAjyL40PWjPo89Nvao14CsQAo58c77sZbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787866745; c=relaxed/simple; bh=bEnireCq0RH6DLCTSlxSBL5TaB+3RLRYmcbvs7jC1Lc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=tzR9TLIoQBxiK39r7plbY+7EI3vGR/PAlk69jJZC9n+8TxUukgOEt6+qo35jxkbKCcc7P2RLt+7qpYFBXm5qt0tIufIF38oL39PQfjbBFf7VVJVgSjWEj4WcA9rCmE73qI5JY96cHPdy7wIBGvSzMdGJKZMVktV1Hkxe3Ofk9uU= 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=xKIEkIEq; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=j7XAnXR+; arc=none smtp.client-ip=103.168.172.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="xKIEkIEq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="j7XAnXR+" Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 80888140014D; Thu, 27 Aug 2026 17:39:03 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-09.internal (MEProxy); Thu, 27 Aug 2026 17:39:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-transfer-encoding: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=fm2; t=1787866743; x=1787953143; bh=2dJ7uZS1t+H/okYb0sbtBr9D8g7KbSzZy+BAJyNfa3k=; b= xKIEkIEqcUXzyLJl4vEAMNA8aQBAtWCgA5r9srjrRpTuaUB2N1C4ibYkdDeRdw2x 7DKbAJlqXJ2A6Q67XSha/NpvfkAKNk5bfx5ejt8x3kmvk7aD+attYWcfTw7ItwIy 2LS7pGOPiY7KVEjJtRgBWGy9PLuwWWGQyEqfP2pvP9orgcRbUWhmD39dWFqn59Uh YpOJhb+ZSErZ9SiCOYL7NZH6jKIAQ4Nigy1Wp0lt2zJjDbIhVCI/JNRePiBiKXaa 3bYREoIFoKpZPb0crJ/RBHDux+L/6I7f5Ju0niWV1R0HyomTIzTDZdV9k8zPJqXI 3/3L0KkrDNqNlbxtkEzeTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1787866743; x= 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awwNu6/Nrs6qaIPQLvk2VM92neqye3HqEHe615L0xTdLxmtWkusQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Aug 2026 17:39:03 -0400 (EDT) From: Junio C Hamano To: Ben Knoble Cc: Hardik Kumar , git@vger.kernel.org Subject: Re: [PATCH] builtin: replace the_repository parameter in is_bare_repository() In-Reply-To: (Ben Knoble's message of "Thu, 27 Aug 2026 17:12:19 -0400") References: Date: Thu, 27 Aug 2026 14:39:01 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Ben Knoble writes: >> Le 27 août 2026 à 16:30, Junio C Hamano a écrit : >> >> "Hardik Kumar" writes: >> >>>> In general, builtin/foo.c::cmd_foo() are concrete programs that work >>>> on specific repository (i.e., the_repository), and there is not much >>>> reason to rewrite the use of the_repository to use "repo" given by >>>> the caller which is git potty. You'd also need to deal with the >>>> case where "repo" is NULL (hint: "cd / && git foo -h"). > > [snip] > >> The utility functions builtin/foo.c borrows from outside builtin/ >> directory are being "libified" to reduce the hardcoded dependence on >> the_repository, and cmd_foo() can call these functions with >> the_repository as a parameter. But we have no reason to waste our >> time updating (and also reviewing patches that make such updates) >> the built-in implementations themselves to take a pointer to an >> arbitrary repository. Line wrap to reasonable length. > Hm. What if a program wants to do « exactly what ‘git switch’ does > » sans shelling out? Instead of cheating, properly factor out reusable part from cmd_checkout() into a set of libified routines, and make both cmd_checkout() and cmd_switch() to call them An approach like that would help "libify" things. libifying is not just reducing dependence of globals. Calling main() from something else is not a libification.