From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796040925; b=fa00KxHJm2bNRno0Wo/aySDw1jOCUMOYM4hs2aZbq9iV3vgMPjPDec29qrn27ymAv7Sw vrMLLgAumeR86QZOMxZefyQmxryaJPYioWmYmEewAvKALikxDKxYwz/pKf0Qaaj9FLSCm PWnMXxY/Lpdpcb7qEyxxP0LUZYMBEN1AxY4S/SIaxsqmO+sGSBh/hHvqovRx2aIX/5DT2 yqoqr5ZjIcLwAED+5yBlxLY0jWt+raP/fqlwIJnlIIGolqfKsOhXjOVTUwZq6KB00XpqU tiW4VuTPi8vFJg2kOARuDk0gbF6Jt7qudf/O8DfbCyqZXGv6PsksnSgS68SLiJ1sGiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040925; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=ngM2NEIo2unpeS3aMaa2Zs2XvyekcfrsItBWWmhwmKY=; b=yuFoUZJ8coexKCEiy39XBIeW8NgRNoYt4l9jJNaCGtK4eUCivHqRjdcDkUcyyteP8/Z8 EuMcns3ra/LCejYtG9uQmqr24ffWFsVb1CNuJO+EDWbf8Uk8b+EBo9QdmNHBpmP/2wHQM Md8CdEQiuyg9ISq5p+sQ10upDM4ioM/pFRO4fMHrRa7eTQNwPckl/yz7PEejTujK1jf4a PgiwT6K1wT6JSCpevqat4fOmBDvdmjgFRlZXzaNJTdXBxl50O9JuKhmF7pj3KUnBNlv23 BqlY1tkb7FgTu2+4CYvXEJWaopC18YpX71ZPvQZTMy2UZv8sm6J/DeREArchwkq/2Xg== 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=00NPQnd5; arc=none smtp.remote-ip=209.85.210.170 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 ACE0F606A320 for ; Mon, 30 Nov 2026 12:15:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ACE0F606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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=00NPQnd5 Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-8c700d6cc0bso5403566b3a.1 for ; Mon, 30 Nov 2026 04:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796040924; x=1796645724; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ngM2NEIo2unpeS3aMaa2Zs2XvyekcfrsItBWWmhwmKY=; b=00NPQnd5Zpnbvmh8RRIlnbrRc30CnRlNi95rvO+rbEd1pDiMS1N4mzkwXNzE89hLN7 KL4h9Alpt+h8QouKyvzp+WpF0ymm5tFtWZ/CdHF97rMEQE9gLe2jotb/wp1gnTTQkV8R Lbmnqb9FnmhQFOHYDwF2NGtjFugxVZpFcY/SSUTFSh2GJC3YqO4cK2ZZsYnw2cIo09iE VFk8R1STCsATDmUWchuIGP0h7oP4Agz2jMuyroNJdA5ZDOoXGJKwykBy3JiFgL+7qM6R /4pzfwbcxyeJswiKLuAUOlxGtA7St9tJHQz/IqcQux11OjHjD5bT09Uymg9NeaqAjihx oB0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796040924; x=1796645724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ngM2NEIo2unpeS3aMaa2Zs2XvyekcfrsItBWWmhwmKY=; b=u8t8eq/LESI8PJm31fE7UONLKdnAD+3I8TPbg2/iwS549JlL38UnCzMHAPMXOgehK0 kAo03B6DelrXvIPQ+6DM8VBlEMt6zZ2N1CPp2BSODjWFBJNtr8QbLX9mYx6BT3Jz92gc X+lXZ1cqjA6fwpc+eN4ZLqVS/Q7ynM955VB7UNG5c1/wPGhQccmeZE41u+6hp0ksEMJP 8ugA6IJqkCucSlXmeOPoYaQJd750kezV2fKoYFsXBzqv1XhslCl8AnHbyTgLYAltKB7u zgtqU7HXenRbMep7i4GmBivjALoQmQ6PsvcYcy2Mh1lShqPzQxALXrqLmtSutpmSnanf U1lg== X-Forwarded-Encrypted: i=1; AL+hErGsCaQslppQguv+4btnBo5D7dF5vx+HjQrMoGZg45LN9hLxRNjwq08BZJVTIorrj+bgy5s=@vger.kernel.org X-Gm-Message-State: APuU4Z+tWwnzSmVyojiNZLbD5qjd8oIln9CPdkXIM0XvM/tLpSDWHa7T 2qB4rg6jLPqSWA+p/5KpuF9FPYg/oRyN41G5VblDMz4VSpcPExjs489Mi5PoHBAD0G4= X-Gm-Gg: AZFdTZd6NnvkQTHeu68OD0x5YgZGFEwPdZchcjHfyBY7sa+B+QTJaTvN0ccdsknGN5w M1nm0899iUPefbH4tXXUtpfemNvUeBxzcNaCVoF5gMLsnkrUujcfYHwZNqmqhvnrDAOgo2ixFFi T3KdZU6h62Rv2Wf9jl2dKBfvcokado9mSxJTPZeEvZfZcG6y8t4DKUmS4KkaTItJtV/CRJ2+i5l hXW56HfviOqXx0bzERqkPbtTHHLzFrjdUARJpsA96FcN+Hq1H8/Ab+KH/HLBVX0KxOh7k0h89rd MbpnWod/XdZiD8FuBdJY9UclcOaE9v0SRe4LEA8p9Qysngf6nz8GYw5+3bG5i+ezAFYdhY17ySx +WPk/MwX7bLJpgEgrOEOqmxfg+hxTrZPUyz2nKKprtaqWytLYgntd5XrgMr6EPry6FfL66HhI28 CI6c5+rcic4ipbympxHJgAv9NAS500Ku8avKyH3Phdje/QK1CJNYA0Z28rJiX23hOLoyB3ZynRY vNVa4lTBWs/6WicGxPVJc/dJM0PzoRfv5CELKOZYnTMZC3Pu722WnbKkxk+9H20Ur3GhTZAgKA/ pX15YadCoBS8pIW5VGwiEpA4wkPwth3N55oJD9sWPULjTmkPLEMUVLQPkTBX+oVHbbTuGhforBp +cL6b5gjkHZM6NbdJLbMP4g== X-Received: by 2002:a05:6a00:3e23:b0:8b6:9702:7f3d with SMTP id d2e1a72fcca58-8c7dd306d3bmr22888259b3a.14.1796040923814; Mon, 30 Nov 2026 04:15:23 -0800 (PST) Received: from localhost.localdomain ([103.25.231.125]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c872e45756sm17728928b3a.27.2026.11.30.04.15.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Nov 2026 04:15:23 -0800 (PST) From: Aniket Gupta To: Toon Claes , git@vger.kernel.org Cc: Patrick Steinhardt , Junio C Hamano , Phillip Wood , Nikita Bobko Subject: Re: [PATCH v2] history: refuse to rewrite branches used by other worktrees Date: Mon, 30 Nov 2026 17:45:18 +0530 Message-ID: <20261130121518.70958-1-aniketgupta3001@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <87qzg2r1wj.fsf@dev.null.iotcl.com.invalid> References: <20261123103911.98860-1-aniketgupta3001@gmail.com> <20261127173252.7794-1-aniketgupta3001@gmail.com> <87qzg2r1wj.fsf@dev.null.iotcl.com.invalid> 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-Transfer-Encoding: 8bit > By reading the comment above is_shared_symref() I've noticed this > leaves a gap open. When a branch is checked out in another worktree, > but has an ongoing rebase or bisect, it is not detected. Thanks. I indeed can repro this. "git history drop --update-refs=head second" exits 0 and moves 'other', and the rebase in wt then fails with the "cannot lock ref" error which you showed. A rebase or bisect of the branch itself is detected. I checked both. The gap is a branch that another worktree's "rebase --update-refs" is going to update. The default mode misses it as well when the other worktree rebases a detached HEAD. > I realize this is pretty much an edge case, and I'm not saying you > should address that gap in is_shared_symref() in this series, but I > think it's worthwhile to mention that in the commit message. I think I can close it in builtin/history.c by also looking at the update-refs state of the other worktrees, so I will try that in v3 with your test. If it turns out to be bigger than that, I will mention it in the commit message as you suggested. > There are situations where using '--update-refs=head' would not help. > For example when a branch is checked out in another worktree (using > --force), or when you're operating on a bare repository. True. Can repro both when the branch is the one HEAD points to. It also happens when the current worktree is in the middle of a rebase. In v3, I will not show the hint when --update-refs=head would refuse too.