🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1395

Re: [PATCH] gitk: add cherry-pick -x context menu action

#1395
From: Johannes Sixt
Date: Sat, 24 Oct 2026 15:52
116 lines
11388 bytes
Please paste the contents of the format-patch output into the email; do
not send it as attachment. See the format-patch man page[1] how to set
up a mail client in a way that does not mangle the patch text.

[1] https://git-scm.com/docs/git-format-patch#_mua_specific_hints

Am 24.10.26 um 11:40 schrieb Ralf Habacker:
> For example, this command is very useful for cherry-picking
> commits into a stable branch using a reference—something that

We need an en-dash or em-dash (two or three dashes) between "reference"
and "something" to give the sentence the correct meaning.

> otherwise can only be done from the command line.
> 

Personally, I use cherry-pick -x so rarely that I have no problem going
to the command line for those cases. Since the context menu is already
very long, I am hesitant to add a small variation of a command that is
already present (and very useful).

Are others interested in this feature?

Below some comments on the implementation just in case there are.

> Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
> ---
>  gitk-git/gitk        | 15 ++++++++++-----
>  gitk-git/po/bg.po    |  3 +++
>  gitk-git/po/ca.po    |  3 +++
>  gitk-git/po/de.po    |  3 +++
>  gitk-git/po/es.po    |  3 +++
>  gitk-git/po/fr.po    |  3 +++
>  gitk-git/po/hu.po    |  3 +++
>  gitk-git/po/it.po    |  3 +++
>  gitk-git/po/ja.po    |  3 +++
>  gitk-git/po/pt_br.po |  3 +++
>  gitk-git/po/pt_pt.po |  3 +++
>  gitk-git/po/ru.po    |  3 +++
>  gitk-git/po/sv.po    |  3 +++
>  gitk-git/po/ta.po    |  3 +++
>  gitk-git/po/vi.po    |  3 +++
>  gitk-git/po/zh_cn.po |  3 +++

Please do not edit the translation files.

>  16 files changed, 55 insertions(+), 5 deletions(-)
> 
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index 9506739c50..5d9c781778 100755
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -2859,6 +2859,7 @@ proc makewindow {} {
>          {mc "Write commit to file" command writecommit}
>          {mc "Create new branch" command mkbranch}
>          {mc "Cherry-pick this commit" command cherrypick}
> +        {mc "Cherry-pick this commit with -x" command {cherrypick 1}}

We are in a UI here. Avoid jargon. ("What is -x??") How about:

	"Cherry-pick with cross-reference"

>          {mc "Reset HEAD branch to here" command resethead}
>          {mc "Mark this commit" command markhere}
>          {mc "Return to mark" command gotomark}
> @@ -9167,13 +9168,13 @@ proc rowmenu {x y id} {
>      if {$id ne $nullid && $id ne $nullid2} {
>          set menu $rowctxmenu
>          if {$mainhead ne {}} {
> -            $menu entryconfigure 8 -label [mc "Reset %s branch to here" $mainhead] -state normal
> +            $menu entryconfigure 9 -label [mc "Reset %s branch to here" $mainhead] -state normal
>          } else {
> -            $menu entryconfigure 8 -label [mc "Detached head: can't reset" $mainhead] -state disabled
> +            $menu entryconfigure 9 -label [mc "Detached head: can't reset" $mainhead] -state disabled
>          }
> -        $menu entryconfigure 10 -state $mstate
>          $menu entryconfigure 11 -state $mstate
>          $menu entryconfigure 12 -state $mstate
> +        $menu entryconfigure 13 -state $mstate
>      } else {
>          set menu $fakerowmenu
>      }
> @@ -9881,7 +9882,7 @@ proc exec_citool {tool_args {baseid {}}} {
>      array set env $save_env
>  }
>  
> -proc cherrypick {} {
> +proc cherrypick {{withx 0}} {

If you make the default value of the parameter "-r", then the new caller
can just pass "-x" and we do not need the conditional below. (Also
rename the parameter.)

>      global rowmenuid curview
>      global mainhead mainheadid
>      global gitdir
> @@ -9898,7 +9899,11 @@ proc cherrypick {} {
>      update
>      # Unfortunately git-cherry-pick writes stuff to stderr even when
>      # no error occurs, and exec takes that as an indication of error...
> -    if {[catch {safe_exec [list sh -c "git cherry-pick -r $rowmenuid 2>&1"]} err]} {
> +        set xopt ""
> +    if {$withx} {
> +        set xopt " -x"
> +    }
> +    if {[catch {safe_exec [list sh -c "git cherry-pick -r$xopt $rowmenuid 2>&1"]} err]} {

-r and -x are opposites. While the last one wins, it would be great if
the one option that is not used would not remain in the command.

>          notbusy cherrypick
>          if {[regexp -line \
>                   {Entry '(.*)' (would be overwritten by merge|not uptodate)} \

-- Hannes
Technical Details
Message-ID: <75b5e0d7-9608-4e2f-a60c-d278af5b2e85@kdbg.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73158-linux-kernel-git=dewy.ru
References: <84e29b80-e219-44ed-b98a-b224d7c264d6@freenet.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73158-linux-kernel-git=dewy.ru
From: j6t@kdbg.org (Johannes Sixt)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] gitk: add cherry-pick -x context menu action
Date: Sat, 24 Oct 2026 17:52:07 +0200
Organization: Usenet Network
Message-ID: <75b5e0d7-9608-4e2f-a60c-d278af5b2e85@kdbg.org>
References: <84e29b80-e219-44ed-b98a-b224d7c264d6@freenet.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="797915"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:lRertHE0P+UDFzs5GQ5ywNozDbM= sha256:vXGfIQ0Aac0CJUyxa93ri9xsS7GVhnH5orcjaaK06Ys=
	sha1:rk6+zqgkvWxF3pPBAVZPGYffZc4= sha256:Pb2aVCLyFgr0C2pv02aSwZKuSxegufsOMxFdZDs7vz8=
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 A58B6111678; Sat, 24 Oct 2026 18:52:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.949
X-Spam-Status: No, score=-2.949 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 kXJz4EaEbNBy;
	Sat, 24 Oct 2026 18:52:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73158-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=kdbg.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 77DD911166B; Sat, 24 Oct 2026 18:52:24 +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 38FEE30B0D; Sat, 24 Oct 2026 15:52:19 +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=1792857139;
	b=cal7Ra0stSN38/0B3tdtQhkZwPgQpxe6GtThpvjlTQj6MP3ZZLjbPeACO93ZEQ4Juwbi
	 wZmBRSDo+uytXxoU/plTXtiVBwRFY0+j9d07BjTGPwtOfBErLG6PBT6JjNAVbTmFtCAj8
	 bdlqMHFRjaZEPeoN0ZQ3NAPUPArUVRiR7XyExdL+aHIz9O9Rk3E+5tCfPH5PF/QjYccXn
	 sOxQFNs7Cf9BIL40KNVk/QFdI1RyUfpO+96kKM8+wYvwrRHcJmxs3+xMjabbAR4+TQCbe
	 8QC5vIJMfsW3MGEDmN3wigRLIT41cRiXZjx9xN5PxOq1YgPz/xfPJKXSA5o5bt2NWzA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792857139;
	h=X-Original-To:Received:DMARC-Filter:Received:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:References:Content-Language:From:Cc:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=ddXhbAuMi8HsiiqzeUidvRa37cVXcGe6nsh/kyE8lzU=;
	b=WYHCnYYYHSAHWtFNQvuXJ4+5hGNWEZ2SYnmsLrdNjpQIW7RfjsyOE2rmsPeW8pxJgOKx
	 mdf+qkaR47tlgTzSKoDqNePzJnqGtFA3BeJfWyGWukgECgAx2UGZwtDcG8pDrKYsmr9+R
	 VZYqRm7i57VKFI+SI/eBE8yI84Zbb3dQi0bub1VWHB02lX+Fd6a9bRX3/ngMLblWU+ySh
	 pIxu2TDRg/uUzP4UXvhkF4KpgJmBGrCJY4dNKKd22XtpzmStM7WX0ogNNmWlZuTK1Nu6L
	 ZMfGr+0dBjTni3XYUhCveJr+YgM4kqhcaVqidIuoE0pkKe4M6hRQwzz3H29z53hZvpQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=kdbg.org;
	spf=pass smtp.mailfrom=kdbg.org;
	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 EACA7606A321;
	Sat, 24 Oct 2026 15:52:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.33.87.17
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792857138;
	b=HzAv3cWQ+7WM51BqU4OXiB0KryG/IhaogkOv/e6yvbScozac58GgYn2XMsUJGEdGwxJt
	 XdxpHTRRPrG01pDv8QyW+CKSq/FeyL1pJNPNGifYLyU7wL2KD9EfVJftR/8T8j3Wa3p31
	 PY/Faj3S0kbRk0gkvXSWr4/G8lCDB1IkqfQ4P2QZumXkgjrB2Jpwpf416J3CKu11zZ6MZ
	 0LYgdc2b1fwxpLAOU5CGHzvyiqat23Fz6aUKm70Kb/B86FQWM5rAjCyXqc/VHuEScCCHQ
	 XEslBQX3hSWjyR+avb4ADOveTrvj7ZQVkLAzuLDHq32FObi6JJhVkri/weHzyMoj5NQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792857138;
	h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:To:References:Content-Language:From:Cc:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=ddXhbAuMi8HsiiqzeUidvRa37cVXcGe6nsh/kyE8lzU=;
	b=4b4DX94rBXt/B+bPDhGMaOrpYHYOx2V+qXYYCSRwf8w8X+EUvjOiFD3aIYL5E3+2ja05
	 vfQOYUO//QqBX8BALaIPCicE/sPYC400hg27NVcbz4LQpy3icqKY8yxqe39hO0ypejCXQ
	 sn7pYNV2QFeDZJZMG5EGHhHadCUuL4LAnCm/y8skkMdlQy5Zx/svM9Ut5oYSw5zwzn6go
	 MZq2s72dJ2WxZpQYQmpZGKO6+jYZ7KUj5vm7TPYeXBxrX9ES/zhVFOIP2H5Y2m9UGSSgq
	 yhZpG4cqajv8+pxCMGFWx2TK8QBMpppQ+hT7dEMhDFkezuHxUUxkIKARXY4V4+Er2OQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=kdbg.org;
	spf=pass smtp.mailfrom=kdbg.org;
	arc=none smtp.remote-ip=213.33.87.17
X-Received: from bsmtp3.bon.at (bsmtp3.bon.at [213.33.87.17])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 646AD606A31A
	for <git@vger.kernel.org>; Sat, 24 Oct 2026 15:52:17 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 646AD606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kdbg.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kdbg.org
X-Received: from [192.168.0.102] (unknown [93.83.142.38])
	by bsmtp3.bon.at (Postfix) with ESMTPSA id 4jBksh17tGzRnD5;
	Sat, 24 Oct 2026 17:52:08 +0200 (CEST)
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-Cc: git@vger.kernel.org
X-In-Reply-To: <84e29b80-e219-44ed-b98a-b224d7c264d6@freenet.de>