From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (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 E6F053D1AB3 for ; Wed, 9 Sep 2026 09:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788945820; cv=none; b=XG/onk8hlA2utkGiVZXOc7W/0rdmGmMdswsueij4yXeVqSeLjTc3tD4PGujX4J5cJfTnTO1rI2KmjYiaabry8vPwMWRRA6eBXhVS9UH8axGmHqJPKA9P/13JaFtGcJCIfWlfJJdEs+QR7ZbC2hB9KJ/tna3p5cksAThv8noLa9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788945820; c=relaxed/simple; bh=AAA0xpxD9fu0XoXlVrmU8eecwbmPdrsCRkbRC1Dcq/Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TeqJY36lBfXQOyBvDtED+n89eY/BeeLS9PBqkixYlP4CNEvya4i85ydjj39k1rd9Pmqk9tlM9Gu3J3CfcllNcDNra6Jv+gU7gCIZt9jH8JzfUjh3UOraphub/QK/jbU5v2NNtJLA14TvJ/MbRitUbpu9Woyu6JMpGGHKmtghDHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=VNRey8me; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=rKWLo8lI; arc=none smtp.client-ip=103.168.172.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="VNRey8me"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="rKWLo8lI" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 0F673EC0074; Wed, 9 Sep 2026 05:23:38 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Wed, 09 Sep 2026 05:23:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; 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=1788945818; x=1789032218; bh=JIBLwcNweh osqnRIyjv41ZcNjrIA3S7OPi+4FBtUmaM=; b=VNRey8meWBZakiaWPHNSFUwGSj sJ/uRJbLfZlPJYBZejRlF0MHkSAaHrSLek/5x8E7ZuVcJaPZ/QgF2q7pjLNY3+3h 3QCaIg2iFmIh/YJP/JsZSjL+5waG22Nr+LfrwAUvPI7AITFY1pl1YxyXW0U2PFAK DK36Nl7Wgjbv0aMJkzqHr6TGFsjezFF44EH8PqCA9i+ydx7ZXSHraLkNwLGjEGW5 ff37Cmpz+Y4uP9x21ID9gS3jSqQ8JvIRIkY4R0XJ6XQKqt38D9Ca1sJc78b7gcej /84vk4SRQG2aW91pI9WHot1aa4eA443MDeGTGpDMPPlOrFYQFl0PUFqZ65Kw== 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=fm1; t= 1788945818; x=1789032218; bh=JIBLwcNwehosqnRIyjv41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MaFUSNLt1o4RbOA4w X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Sep 2026 05:23:37 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id e8d78e1e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Sep 2026 09:23:36 +0000 (UTC) Date: Wed, 9 Sep 2026 11:23:34 +0200 From: Patrick Steinhardt To: Kaartic Sivaraam Cc: git@vger.kernel.org, Karthik Nayak , Junio C Hamano Subject: Re: [PATCH v2 08/11] setup: refactor how we configure the ref storage format Message-ID: References: <20260907-b4-pks-unify-ref-storage-format-v2-0-6733c90ca5b0@pks.im> <20260907-b4-pks-unify-ref-storage-format-v2-8-6733c90ca5b0@pks.im> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Sep 09, 2026 at 01:30:55PM +0530, Kaartic Sivaraam wrote: > On 9/7/26 16:48, Patrick Steinhardt wrote: > > diff --git a/setup.c b/setup.c > > index 3be7dac452..38fa5e854c 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -2761,40 +2761,65 @@ static void repository_format_configure(struct repository_format *repo_fmt, > > > > ... snip ... > > - > > - ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT); > > - if (ref_backend_uri) { > > - enum ref_storage_format format; > > - char *payload; > > - > > - format = ref_storage_format_by_uri(ref_backend_uri, &payload); > > - if (format == REF_STORAGE_FORMAT_UNKNOWN) > > - die(_("unknown ref storage format: '%s'"), ref_backend_uri); > > - > > - repo_fmt->ref_storage_format = format; > > - free(repo_fmt->ref_storage_payload); > > - repo_fmt->ref_storage_payload = payload; > > - } > > + /* > > + * If we have a preexisting repository we need to verify that its > > + * current ref storage format does not change. > > + */ > > + if (repo_fmt->version >= 0) { > > + if (ref_storage_format != repo_fmt->ref_storage_format) > > + die(_("attempt to reinitialize repository with different reference storage format")); > > + if ((ref_storage_payload || repo_fmt->ref_storage_payload) && > > + strcmp(ref_storage_payload ? ref_storage_payload : "", > > + repo_fmt->ref_storage_payload ? repo_fmt->ref_storage_payload : "")) > > Rather than a strcmp, wouldn't it be ideal to do the path comparison using > strbuf_realpath to make sure we avoid similar paths like the following from > failing during reinitialization? > > $ mkdir store > $ git init --ref-storage-format="files://$PWD/store" r1 > Initialized empty Git repository in .../r1/.git/ > $ git init --ref-storage-format="files://$PWD/store" r1 > Reinitialized existing Git repository in .../r1/.git/ > $ git init --ref-storage-format="files://$PWD/./store" r1 > fatal: attempt to reinitialize repository with different reference storage > payload > > This matches with how we actually make use of the path at runtime in the > refs_compute_filesystem_location function in refs.c. No, because that'd assume that the payload even is a path. But in theory, it could be anything, like for example a database host to connect to. In `refs_compute_filesystem_location()` it's a different thing though as that call happens inside the backends themselves, and they know what kind of payload to expect. Patrick