Git development
 help / color / mirror / Atom feed
* gitk: add cherry-pick with cross-reference action
@ 2026-10-26 18:42 Ralf Habacker
  2026-10-27  9:55 ` Johannes Sixt
  0 siblings, 1 reply; 2+ messages in thread
From: Ralf Habacker @ 2026-10-26 18:42 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Johannes Sixt, Taylor Blau

 From ae2217025407ff91f3ea3332f94d5b0bdcd01e70 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Tue, 26 May 2026 22:55:47 +0200
Subject: [PATCH] gitk: add cherry-pick with cross-reference action
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a context-menu action to cherry-pick a commit with a reference to
the original commit in the commit message.

This commit closes a gap in gitk’s GUI workflow for projects that
for example require backported commits to remain traceable to their
originals.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
---
  gitk-git/gitk | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 9506739c50..0c7db0a4d9 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 with cross-reference" command {cherrypick -x}}
          {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 {{option "-r"}} {
      global rowmenuid curview
      global mainhead mainheadid
      global gitdir
@@ -9898,7 +9899,7 @@ 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]} {
+    if {[catch {safe_exec [list sh -c "git cherry-pick $option 
$rowmenuid 2>&1"]} err]} {
          notbusy cherrypick
          if {[regexp -line \
                   {Entry '(.*)' (would be overwritten by merge|not 
uptodate)} \
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-27  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 18:42 gitk: add cherry-pick with cross-reference action Ralf Habacker
2026-10-27  9:55 ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox