From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.159 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796210460; b=QvspKTeiYIOtN4QiJ+AujEbDhatrtlF5RLJZnJp2hhh8KtYUkBt31vhldFpIU+DnOnuA UqgV99YoASyF0MUbSUkX2fmpz6soUo7jWpWc4sYXqloToEvijOu6FqXekhir8QihlwkZ7 dpATZhMbsGhH4H3Pz0+R4o4gHkZSCT3rkLfQ1fJ1056XYrSax6PUx00Aj4DOK0f4MGGYo sbztYT3XQFXo6cMlcKTJtMBiKXW8ETrvGC0jlaA9QJHEEEl8caQT1l1BxEOuHNmeBQyMX aS1xWH4hlAkCAlyDeULZ1pwbZM7R/RQBAuy1IDygYnlHbe+sna5r13ijwqUOC8UEkdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796210460; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Pfsyaqqu6g3+wgrOsirQhODrENjZDFz2bZHktJ8zoVQ=; b=bMCGwFeRIqXddNcOX7BkCPLw+q0vXw1cGY/TncrQmFk+s9mvrHCbSQb5OMIS+aivncNr emMdiPSeLm6ssfDNzLT/aw4UGCAyGiWwjq2WIKI5KP0AD9hgq7JpwOgD8p6g+Y86sUzjd oKX7mzglVC8MIH/xWp3ICgLOnzwAPyMbTCLSxMDrcIYcgTaLoISx6t1IrbzqWg9aSqAHH IELjXk6y3sZ1IrDT9C4fP/3ULwRKxK9ThccZDtqAHt5ZzeG6VJlkmiRCmCm+4wms4C1Ge 70g0L0WRRR2vHxj+W+D2UJ0DEDvKUnlayyqIO8wYa1zdDbxPpyiWSoMA9WILR4PbBWQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=Khikzt0m; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=M4xuI7WH; arc=none smtp.remote-ip=103.168.172.159 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14C1B606A6B3 for ; Wed, 2 Dec 2026 11:20:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 14C1B606A6B3 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, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=Khikzt0m; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=M4xuI7WH Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 31A5F1400143 for ; Wed, 2 Dec 2026 06:20:59 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Wed, 02 Dec 2026 06:20:59 -0500 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=fm3; t=1796210459; x=1796296859; bh=Pfsyaqqu6g 3+wgrOsirQhODrENjZDFz2bZHktJ8zoVQ=; b=Khikzt0mDE8ORYhXKaM8HwGZVG 3LWB0qj5ZnR9WOWohgsQ23QpF3juAzeb6pY6vHOEK6vBn5hisjF9Kw3LixHUnMWh LkwkEwXKt3DetnGD3vxv9Q2q90mhTmLcVprZIvfIlaHhMM81H+Cdj8p7EJEUJf9T qOAeh5rDt1iAPqRQILg9+YLg6vC1cTimcmBWhu47FheROU7BhdLjeavNEeRw0umV bko5ccl+lOzWm5LlInaxvuCbpMFgYBQQNczcKzTHyNqc/QfJQMso/rgBm0EW/1gd rHXOf98d9T9BZGweOoccoh4m2PwdshKUAo/5eXeu/bCYMWz1hxwGBuSdjusw== 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=fm3; t= 1796210459; x=1796296859; bh=Pfsyaqqu6g3+wgrOsirQhODrENjZDFz2bZH ktJ8zoVQ=; b=M4xuI7WHY0o+mvZTFxsR7phv7MF1sDw07YYS9eFNmXXdcZjCukA HND2GnMKuT930wXkDT0h/OuQaRUgXyigWKVn2dwZi//k264cXO5BXQ4vnQCfY4pg k5EJcwT8wzYQTdD3zOpaRSJdKYRQn+hfirQNaVpfejR+tCTQG2/fSjIpnTen5O/e qBFHhw6veQM6S39Jss2oG0Ad9GqE7e2JrfaC3rmT0/hSHC481jXoUUy379KtJT+b g29JBIAw/hRxLnq+71DELUKQQhOXZz9dtQfEsZ2BzBmiD61pQo+ggl2ZYHIlo2zt vi/XHKK+O5Uw2+P0q1w5noBRkCHpTevj65g== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796210459; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:XREGS+1mk6vSRyGY83PzwpOYr7ZhAHj0yPYn3p1bLVgwn+l fV7yHmMIWeOAklTckWxYclopxvx1Gdsg3Me76osA6/H5wDRiLNf4vU5ViP0ZwN06 46UjPoHZmuE7hLAeNVs8oKf/KqwW5ZyNMbHw5QFexrr1BQijZLWXFANT68sLGT0B v6JwWfLh6awgE1uvqCTQN2YNWp3/ZKqKZqdvBv0hCeJODkczWtCmDtjXqdShjQyn y3q7hlEFkn9XhKMxkDED7mcLJRozHkqdMwiqSASWxLE2u4MCgdM5tY6OOtAyDjpq P3ZxJE0cY55t9DtnHoLWFaMn5gJ4TlbNZ6CxMWg==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:DeFPu/PSF2k/It5TSYgTSsI6U14JY8TzlxklFhC1qLs=:/Su2zP0zrSoeYF5jXvM3tae5b6PF6SFELwo08zHot4I=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEWjHR2Pf0sigiU4baOdfbwAgcE0cqBjFGqSa5zbNGMSKH2/mPq8a13HtrJpjyKwz XP5O2TWF7a1JO6qVxd5G/1vZdlS6zVzb4aEqClnVy6JguHDJ+KNIV6q7fgx0BogXhOCihL 7T1SLlr0RnU7RstLZ5Of5SqZpp4dTQ98/5qev1uShDzvOxUKatEQ23iwhRQ2LV5rF8EriA 3zIP7mBfzmqmE8Lgj83XZuMqHV0I7vbotkT/IjZ2nkEm7S1C0C8R9558BVwg3k49Ui3Zhv tCr3qVfEA5pTPn5wqw1dmmdfV+cI8CFho/8+MrsMXVYP7gXaC89weUVQ+EMJTh3XOXKnqw fVmWldfmpEnXUVYmnbcyvCNX0u1zbJWM8Yn8nfrKlzVCVJ+FL0QjjFstNrpGTefcePBdh0 1cM6osrq32S+0Uj0aE45YWKQM6Is30UUWPrCIx6j/B/9LSVOJXJ2fHB/QfshApGb1pljYH pFHEbpO5ZI9wWQqtN8HrBtZ9u7hi6zq8nhX27GuJbjm0sQZBm4NvUyRNWVPG56blEUhXCa qhFKtm2o7TYwjhrGJzt8C3zWmQfbO1D5v65BhTV90zm6oBEtmXih5g9n9cvQWXs9smWCpK Fyo0/u8GAMbL1ZjPM8GBo4YfsyNrv0H4/DISKnPFyVQpRJZbSBHKNoVbEFSA X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Dec 2026 06:20:56 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id f5dc1515 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 2 Dec 2026 11:20:55 +0000 (UTC) Date: Wed, 2 Dec 2026 12:20:52 +0100 From: Patrick Steinhardt To: phillip.wood@dunelm.org.uk Cc: Aniket Gupta , git@vger.kernel.org, Toon Claes , Junio C Hamano , Nikita Bobko Subject: Re: [PATCH v2] history: refuse to rewrite branches used by other worktrees Message-ID: References: <20261123103911.98860-1-aniketgupta3001@gmail.com> <20261127173252.7794-1-aniketgupta3001@gmail.com> <3d2e9653-87ce-48f4-a154-2b5a1a31a84c@gmail.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Dec 02, 2026 at 10:59:47AM +0000, Phillip Wood wrote: > On 02/12/2026 06:23, Patrick Steinhardt wrote: > > > I don't think we necessarily need to implement that all at once > > > though, the checks added in this patch are a good first step. > > > > We can fully avoid the race by doing the checks when the ref transaction > > is prepared though, can't we? Well, with reftables at least its trivial. > > With the files backend it's a bit of a different story though, > > unfortunately. > > To prepare a ref transaction you need to know the new object id. If we want > to check we're not going to try and update the same ref as another process > before we rewrite the commits then we cannot prepare a transaction. If we > want to handle this entirely in the ref backend (which I agree would be > ideal) we'd need to be able to say "check this ref points at this object and > lock it. I'll tell you what to update it to later" before we rewrite the > commits and then "here are the new values for those refs I asked to to lock, > please update them now" after we've rewritten the commits. True, and we know the new object IDs after we have called `compute_pending_ref_updates()`. I think ultimately, the discussion boils down to different ways to perform the validation: - The proposed version does pre-flight checks, only, and does not verify whether the eventual updates that are actually queued match our expectations. - In my version, we'd perform cheap pre-flight checks that aren't as thorough, but then perform proper validation at the time of committing the ref updates. I think the second version is superior because we validate what we actually end up writing to the ref store, while still retaining most of the pre-flight checks. It can thus be done in a (depending on the ref backend) race-free way and is more thorough overall. I worry that we're second-guessing what we're about to rewrite, and that introduces a bunch of complexity that we could probably avoid if we instead were to verify the ref updates themselves, while at the same time being less thorough. But maybe I shouldn't let perfect be the enemy of good, because right now we don't have any checks at all. Patrick