🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3695

Re: [PATCH] history: refuse to rewrite branches used by other worktrees

#3695
From: Phillip Wood
Date: Tue, 24 Nov 2026 10:49
46 lines
12809 bytes
On 23/11/2026 21:54, Aniket Gupta wrote:
> Thanks for taking a look!

You're welcome, thanks for working on it.

>> What happens if a rebase is running in the same worktree as the user
>> tries to run "git history"?
> 
> It is refused. HEAD is detached then, so the branch being rebased is not
> the one this worktree has checked out, and it gets treated like any
> other branch in use. There is a test for it, but the commit message does
> not contain this. Will fix.
> 
> In that case --update-refs=head is not refused: it only rewrites the
> detached HEAD, same as before. I tried fixup, reword, drop and squash
> that way, and "git rebase --continue" finished fine each time.

That sounds like a bug though, because "git history" will update HEAD in 
the middle of a rebase and we throw away the result of running "git 
history" when "git rebase" completes.

> 
>> We should also prevent rebase from rewriting a branch that is being
>> rewritten by "git history" but that can come later.
> 
> Agreed, that can come later.

we should also refuse to run if another "git history" is rewriting the 
same branches - that's also something for another time.

>> This is correct, but it duplicates the revision walk we're already
>> doing when looking for merge commits.
> 
> Makes sense. I gave it a try and it works. One point: the branch
> pointing at the rewritten commit itself is not part of the walk, so I
> look at its decorations too.

Great, I realized that after I sent my mail yesterday, well spotted.

Thanks

Phillip

> Rewriting a commit that another worktree's
> branch points at goes through without it. Will do it like this in v2.
Technical Details
Message-ID: <14c971ef-438c-4197-b0cd-df9bf0ef0ae4@gmail.com>
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76212-linux-kernel-git=dewy.ru
References: <20261123103911.98860-1-aniketgupta3001@gmail.com> <a0ebd98f-669e-4ff2-bca2-cfd5da5a7316@gmail.com> <20261123215431.27574-1-aniketgupta3001@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76212-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] history: refuse to rewrite branches used by other
 worktrees
Date: Tue, 24 Nov 2026 10:49:42 +0000
Organization: Usenet Network
Message-ID: <14c971ef-438c-4197-b0cd-df9bf0ef0ae4@gmail.com>
References: <20261123103911.98860-1-aniketgupta3001@gmail.com>
 <a0ebd98f-669e-4ff2-bca2-cfd5da5a7316@gmail.com>
 <20261123215431.27574-1-aniketgupta3001@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4116032"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NdrHQcVAH+YHUQfrL1QEh7meRq8= sha256:kb/+jJMPnCN1pkBL1slgmxnrmg9sc8aMST4mCuMGFIw=
	sha1:VM1GvVEZF14IOFCdQpFs+/DOl98= sha256:ybC6ZRU+qPTlJWdacRxli96Widm+iO31/rTs2HM09II=
Content-Language: en-US
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 256CB125DF5; Tue, 24 Nov 2026 13:50:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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 (2048-bit key)
	header.d=gmail.com
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 G2yALS6C9KFT;
	Tue, 24 Nov 2026 13:50:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76212-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 53998125DFB; Tue, 24 Nov 2026 13:49:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id D78A73C085; Tue, 24 Nov 2026 10:49:54 +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=1795517394;
	b=XfGeVgaSQbBfhLxFlgKycqo/WD/jMjoxjMr2IRsQCUuD4w8wf0SRFUssZlB9DtBe0DDN
	 uA/EUDW4tYJTjVhCkQ9XSbYmm6nPavTLTS5I4Pze6JXyZWpGIZFEK2WwgeBas5wJMvd/n
	 dY/I4vofmi/rBWQ6mhP3Hespsk5va2tLDsyX5EhPvbaEd+zKFrNT8Vm9kezbkF/hQzD8S
	 KJkz6tRcA+L2rgjOmn2tHQkq1Snt4Uvq5P85KymKlS5Sxfa7s+shVXLWSdJyfsQuDVESI
	 zyKUTseLDne85ZuwKks6MUTIwAYZU7zGPi+nSmKbz4/RpTUorKLbiObVAB0LmeQtaEQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795517394;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:From:Reply-To:Subject:To:Cc:References:Content-Language:
	 In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=Y8DyfBtH9fr/Nwmfb1EoBB9wbbudMm/SgC7D8YJtFhg=;
	b=287T5/jmgLrBEvg07vWm15pCeoPvKB4/GUqFdMJqsojfFPf0+fFdpg+Y191wjQbr4Src
	 CTNtmzAbrW5uGLhlqeQRKQtBhNa543/BnCphvTe6Q7x6wMfrpe8gvdLAm8jGCc8FmXXAY
	 0/YCubS9SLMXx9Qv9YCmXlbUj86Ukd3Fd87NNMJ4Em/lzqKXppA/OpRxLeuXjvTLfHq0j
	 PaUY/lXtpHAThhvh6RGTekzrAP1ChURahbjcZ9s/8s1UYKVhrwTjcPWTelvqC0NB530iQ
	 dSqiUdJNu9R5ngqH3+jOKkIxVMrau8p2XM/2H5u4eX4Rzx55hE7jxO+7mONcNYgHlyQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WiwXOKDp;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 AA6BC606A32C;
	Tue, 24 Nov 2026 10:49:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WiwXOKDp
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795517393;
	b=VszhAMyeeftOg+KJtehqD6JdBd+3wgzwQeUFD7TryUCkYZ/TX6xvrGqQtLa37UaVHuDi
	 JFzQdQK3GhSq36LByWiUXn/1NNjjteZTAGV2fLG5C7jv6rKy0Vuv36uE3E032YsVmgp/o
	 C6N+7MpWKTtYcDG54P4yB2wUCsO97WPbB/c5WjdFy5nlwEUFcqk/HoOY10fH+pEwUhg2K
	 Bf85q8nHHBVScC8TmzkbE+b4SVtjWSXAtNZeNGOOJF7BFCiOOZ76Teb3gjdbSQAnKV5DS
	 iKHmijimxOdKzrvOMM5Qbt2eWLsw0Vx9EOE8c0ZF1a8UWTm+MhZBVtta03PGCnswChw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795517393;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:From:Reply-To:Subject:To:Cc:References:
	 Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=Y8DyfBtH9fr/Nwmfb1EoBB9wbbudMm/SgC7D8YJtFhg=;
	b=kaKnyNbqwZ9v1hsXL91+zBroS6WnjnYarLpbgChuyg5a8ZmKIm8gc/sZwyxH+gadyCok
	 47hhpoiqknudL+TVcNnxUFSWCo7TCJhxHD0E6VZx7/R+I2DNZBN9Jh913t+7ZbHfKZfVk
	 XgjOx4g8xxH8CzYRv45iPLkQQK/zfgDQdrg+8DzmFiGk/fFUwou9m0uAEdpWR72zf/8SF
	 9dQar2hRpz68Wg3wLk+UTmPQX217M7+oXyxcuBCiI1FbuylZP/zTo2VkFj9KszDbvgXkE
	 FeBdCgYQaaDWKp07b9pyP/E+n+thimIqDBucSLbbRUxsySwFlW3BHUW9TZNEz41o9pQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WiwXOKDp;
	arc=none smtp.remote-ip=209.85.221.53
X-Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73B79606A31E
	for <git@vger.kernel.org>; Tue, 24 Nov 2026 10:49:53 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 73B79606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-48dee593f18so4125809f8f.3
        for <git@vger.kernel.org>; Tue, 24 Nov 2026 02:49:53 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795517392; x=1796122192; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :references:cc:to:subject:reply-to:from:user-agent:mime-version:date
         :message-id:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=Y8DyfBtH9fr/Nwmfb1EoBB9wbbudMm/SgC7D8YJtFhg=;
        b=WiwXOKDphZugBjjMg62Jqqp3qZqGX6zdmwo/Ben3hvdQuupBCsdHWZfOXEuelasQoA
         64j1IC4V6sdnIEhnMWm/XbJzuixnXacPlOUrjI/ez9Kl4MGq6fpjAf9+lxk95NLPIkIx
         JaA8MXVmk3g/0O7LT1B4k/UGQSalYgCkJUhW0khPGaGsVMvd4wEcIw7lw/UGWgQXrFmf
         UOy0VP/e6ihhPwE5+RkkECKB5yXfsI6wQr3QEmrisDIU7XJ7SUEpFXXV+bVMSwY7WKdf
         RJdbqvy22pDylYIIf0esxlyWL1+qNjn/SiP8LAdFMtHiUhI3MNRiN4JUKWD4gAGwaBQ4
         peZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795517392; x=1796122192;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :references:cc:to:subject:reply-to:from:user-agent:mime-version:date
         :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=Y8DyfBtH9fr/Nwmfb1EoBB9wbbudMm/SgC7D8YJtFhg=;
        b=JIzSp9ZBCVWHhM9A6HKotI+iJPxi3/aSrThY6TuzmOpzdhqsHYzuDSW9YJl4cMfi/C
         4MBTibE+MXimL5wswSRQVYTheI8dJTMn53MBWHBeU44//2njMUsnIWgZL1SwOv560wSX
         t7utYgdteGHnK4UL5n8XRF5JA8vgCZnucrvC2RzNBSqI2kYQw4uJm0tdFhAOskAn6V7u
         stIyF4eFTwFG6/PtSthP7ebEyLMclHjMHeu/MtrbM0ci2PfpJK0CbgfEpcbXNkaZVqp3
         naiIXJu1/PZxHFyIfqMNGNcyen15xyUvZaSvrrwV+7vRxFaggX6X0i8ee5CRMhH7gcz8
         MPcw==
X-Gm-Message-State: APuU4Z9RMk+nZZ+6tvQdnIRqblRpyh1N+t3+h2qK78O6seQOeT/v9Bex
	RkbwB4JMI//6+zwqxFWs6S1+dTIHqeGdxW9QaOG24dhC7gMFYwPEVetJ
X-Gm-Gg: AZFdTZe5dim2bU5B0o+1S854Kfcm7KAYw8SPEgnIXuvQbtROTAa8oMjRUpW/DGUTBuh
	RYTAm4clp6ypbtxAZZlM07MJd32M+kg5guHXh8eTmBPy9e5YCZh3SXFqjraPTy4GqMfdg81mhsk
	SGx2KqkXbE4TTx933bs/kxYd4OnMCVd5pRdv5ZslzlHIYX+l5VczAlI5/kb0Xf0eiHejfHFGG9D
	DtUZ2HAH1V8S1YkShlra8hK9jbCy3Vei2XQNFQ4r3ZMf2sZPYpJXQMZr2uhBd2G50J1/qqs+QNr
	udqMnrPv18SSGRmAdkrbH3OY7gEwaOEanFjsExyYCpUdYYpWhOnGB3TsZOW4YaZcmSShKtqWz7i
	W77fT8cPajB80hIxiJWOw50EAakFgHh2zIl2WkO2RHnn/TIk4CJHzqpH8a5bWHb/nzvi7bgpt6M
	NvN6cOIMNVPWX22ZUorneYs0KbodBJ0S+l6qOEsFRJCiRNQq74MoZ0Nv7kuwHl4cc5cEsyZ6z7C
	gg7+yxdTv8FqjgzsFrLw/VSWb4AFa0c0DbP0QarX/knirfB6wZViU+2tbgKGbZ9uQRdPbSpmB8t
	o3KRKJENnz13joBiPpq603Xp89/DTs5jcklIzhV8qDCpIhowDcMdNNeV+lr8+aSB5rwK4bq8tlR
	333CoqcxR7+tszmDN9Rocax4XUt+c
X-Received: by 2002:a05:600c:1d29:b0:4a9:2a92:231f with SMTP id 5b1f17b1804b1-4bb88804d4dmr311354505e9.7.1795517391523;
        Tue, 24 Nov 2026 02:49:51 -0800 (PST)
X-Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6bb989eesm27322340f8f.50.2026.11.24.02.49.50
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 24 Nov 2026 02:49:51 -0800 (PST)
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
X-User-Agent: Mozilla Thunderbird
X-Reply-To: phillip.wood@dunelm.org.uk
X-Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
 Toon Claes <toon@iotcl.com>, Junio C Hamano <gitster@pobox.com>,
 Phillip Wood <phillip.wood@dunelm.org.uk>, Nikita Bobko <nikita@nbobko.com>
X-In-Reply-To: <20261123215431.27574-1-aniketgupta3001@gmail.com>