From patchwork Wed May 6 15:29:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2278 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778081451; bh=/9fntw4gN4rNky8ym6zj77381nc0ZQ9ingTWemuSf2g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bZ6KJfAMyKaihASgmOMCQsD6YVkGjuflHUd1UuFkctuh7JAS7NZgn++L9C519RPmD dHVXcJpp+lPSGwsGNe0UGi0NWD32vi43j3dc2QH/Jfz7y7PYQJXVPO+Ql62cZrD3s5 H5h3K4ulACMaJstMXYcv9DLY1rwzBT44u46nwXBw= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2B7B06A947 for ; Wed, 6 May 2026 09:30:51 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SexyXF0fJ_VK for ; Wed, 6 May 2026 09:30:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778081451; bh=/9fntw4gN4rNky8ym6zj77381nc0ZQ9ingTWemuSf2g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bZ6KJfAMyKaihASgmOMCQsD6YVkGjuflHUd1UuFkctuh7JAS7NZgn++L9C519RPmD dHVXcJpp+lPSGwsGNe0UGi0NWD32vi43j3dc2QH/Jfz7y7PYQJXVPO+Ql62cZrD3s5 H5h3K4ulACMaJstMXYcv9DLY1rwzBT44u46nwXBw= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1B2316A92E for ; Wed, 6 May 2026 09:30:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778081449; bh=5U3Ve6deYo2MfH+hEqbqcm4WU2tcQdOqXe4xSq93/BY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3S0xNRtiZPf1Y1kakoJzjQCRkCX9oioLybaTUgPgPIUjOm0w8J3tur0veBLdSOtx TYE+tSFDjevEkNbks/n4EALuTuTBp5Pt3qHz7aFHkUo1eke46dH33EYXOy1mYQDxS4 Pmnhym3dEL2RnDE5CbfEoh7WCh+l18RYEUkltl9I= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 44DE06A87B; Wed, 6 May 2026 09:30:49 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id eIrPa0fyhuEU; Wed, 6 May 2026 09:30:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778081445; bh=4IeWFy5ugMJDgkF4wlJnqdrYh+S7WI52i5Ewtb2dqvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JrRwwFIofv58hhKBaTs6H7d9V0O9VeAoCHs3Wvgif3ILODdNw9UN53Knyvan2r58B WXXU7ATIm+0wjsqcGkWQ7uMk84xp5Eaxv/p3dUF2uontAtXgcapFnWACt36vOwoAU7 Bx0OC5gKoqBMzrxJ8VemfVmUiPH5t33ztT6EDMTg= Received: from u-boot.org (unknown [174.51.25.52]) by mail.u-boot.org (Postfix) with ESMTPSA id 179166A92E; Wed, 6 May 2026 09:30:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 6 May 2026 09:29:55 -0600 Message-ID: <20260506153006.529909-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506153006.529909-1-sjg@u-boot.org> References: <20260506153006.529909-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CLNS76TYR4H2JXLNNPCZWRMN6XX3HAYF X-Message-ID-Hash: CLNS76TYR4H2JXLNNPCZWRMN6XX3HAYF X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 6/6] patman: Clean up review worktrees on series rm and archive List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass A worktree created by 'patman review' lives on disk until something removes it. With nothing to trigger that today, abandoned reviews accumulate under .git/patman/worktrees and the user has no obvious way to reclaim the space. Hook the worktree removal into the two paths that already invalidate the underlying branch: - 'series rm' deletes the database record. The worktree has no value without it, so drop it after the commit succeeds. - 'series archive' deletes each version's branch. A checked-out branch cannot be deleted, so the worktree must go first; otherwise pygit2's branches.delete() fails. Use gitutil.remove_worktree() with the path from cser_helper.review_worktree_path(); both are no-ops when the worktree is not registered, so this is safe for non-review series whose branches were never reviewed. Signed-off-by: Simon Glass --- tools/patman/cseries.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py index fb3f5a6c49a..1149eef44e1 100644 --- a/tools/patman/cseries.py +++ b/tools/patman/cseries.py @@ -830,6 +830,11 @@ class Cseries(cser_helper.CseriesHelper): self.db.ser_ver_remove(ser.idnum, None) if not dry_run: self.commit() + # The review worktree (if any) has no value once the db row + # is gone; v1 review series share their branch name with the + # series name, so review_worktree_path() resolves it directly + gitutil.remove_worktree(self.topdir, + cser_helper.review_worktree_path(self.topdir, name)) else: self.rollback() @@ -1252,6 +1257,11 @@ class Cseries(cser_helper.CseriesHelper): # Delete the branches for idnum, name, tag_name in tag_info.values(): + # Drop any review worktree first; a checked-out branch + # cannot be deleted + gitutil.remove_worktree(self.topdir, + cser_helper.review_worktree_path(self.topdir, name)) + # Detach HEAD from the branch if pointing to this branch commit = repo.revparse_single(name) if repo.head.target == commit.oid: