From: Michal Sojka <sojka@os.inf.tu-dresden.de>
To: git@vger.kernel.org
Cc: paulus@samba.org, Michal Sojka <sojka@os.inf.tu-dresden.de>
Subject: [PATCH RFC] gitk: Allow commit editing
Date: Wed, 17 Aug 2011 21:56:11 +0200 [thread overview]
Message-ID: <1313610971-1741-1-git-send-email-sojka@os.inf.tu-dresden.de> (raw)
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
next reply other threads:[~2011-08-17 20:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 19:56 Michal Sojka [this message]
2011-08-18 22:33 ` [PATCH RFC] gitk: Allow commit editing 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313610971-1741-1-git-send-email-sojka@os.inf.tu-dresden.de \
--to=sojka@os.inf.tu-dresden.de \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).