git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] gitk: Allow commit editing
@ 2011-08-17 19:56 Michal Sojka
  2011-08-18 22:33 ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Michal Sojka @ 2011-08-17 19:56 UTC (permalink / raw)
  To: git; +Cc: paulus, Michal Sojka

Hi, this is a proof of concept patch that allows editing of commits
from gitk. I often review patches before pushing in gitk and if I
would like to have an easy way of fixing typos in commit messages etc.

So the patch adds "Edit this commit" item to gitk's context menu and
the actual editing is done by non-interactively invoking interactive
rebase :-) and git gui.

There is almost no error checking etc., but before learning TCL and
coding this properly, I'd like to get some feedback.

-Michal

Signed-off-by: Michal Sojka <sojka@os.inf.tu-dresden.de>
---
 gitk-git/gitk |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 4cde0c4..121b926 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2497,6 +2497,7 @@ proc makewindow {} {
 	{mc "Return to mark" command gotomark}
 	{mc "Find descendant of this and mark" command find_common_desc}
 	{mc "Compare with marked commit" command compare_commits}
+	{mc "Edit this commit" command edit_commit}
     }
     $rowctxmenu configure -tearoff 0
 
@@ -9102,6 +9103,21 @@ proc cherrypick {} {
     notbusy cherrypick
 }
 
+proc edit_commit {} {
+    global rowmenuid
+
+    nowbusy edit [mc "Editing commit"]
+    if {[catch {exec sh -c "(GIT_EDITOR='sed -ie 1s/^pick/edit/' git rebase -i $rowmenuid^ && git gui citool --amend && git rebase --continue) 2>&1"} err]} {
+	notbusy edit
+	error_popup $err
+	exec git rebase --abort
+	return
+    }
+    notbusy edit
+    run updatecommits
+}
+
+
 proc resethead {} {
     global mainhead rowmenuid confirm_ok resettype NS
 
-- 
1.7.5.4

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

end of thread, other threads:[~2011-09-13 23:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17 19:56 [PATCH RFC] gitk: Allow commit editing Michal Sojka
2011-08-18 22:33 ` Jeff King
2011-08-19 11:44   ` Chris Packham
2011-08-19 13:34     ` Michal Sojka
2011-08-19 14:40       ` Michal Sojka
2011-08-19 12:23   ` Michal Sojka
2011-08-19 12:25     ` [PATCH] " Michal Sojka
2011-08-25  3:14       ` Jeff King
2011-08-25 13:15         ` [PATCH v3] " Michal Sojka
2011-08-25 17:30           ` Jeff King
2011-08-27 12:31             ` [PATCH v4] " Michal Sojka
2011-09-07 20:10               ` Jeff King
2011-09-08 20:59               ` Paul Mackerras
2011-09-13 23:11                 ` Michal Sojka
2011-08-25  3:07     ` [PATCH RFC] " Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).