Subject: support for git commit --amend/--signoff
From: Dmitry Gutov <[email-masked]>
To: [email-masked]
Date: Sat, 29 Sep 2012 04:11:44 +0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

This is based on Dan Nicolaescu's patch from here: 
http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00784.html

I modified it according to Stefan's request, and made some other tweaks.

Notes:
1) Magit handles the Amend action in a similar way: it also inserts a 
header at the top of the message edit buffer. I haven't seen any 
complaints from users.
2) I haven't been able to make menu-bar keymap work as intended.
I copied log-edit-menu to the local menu-map variable, and it shows, but 
if I don't set the parent keymap of vc-git-log-edit-mode-map to 
log-edit-mode-map, the menu popup doesn't show the latter's keybindings 
(and they likely don't work, haven't tried). If I do set it as parent, 
then the "*VC-log*" mode line element menu only contains two elements, 
but submenus, one for each keymap. I don't think that's optimal, so I 
discarded the menu-map part altogether.
3) Toggling Amend on/off repeatedly may lead to slightly different 
behavior if the commit message subject looks like a "header: value" 
string, and especially if that's the only line in the message. The 
difference would be in the added newlines, and the commit subject will 
become highlighted as a header line.
To counteract this, Magit inserts a "-- magit header ends here --" line 
after the headers. Not sure if we should do the same.
4) The new first argument format of log-edit-extract-headers is kinda 
awkward, but it's the only way I could think of to make it 
backwards-compatible, and I do think that this is the function that 
should handle the yes/no headers logic. The third element in the new 
form ("yes") is more or less superfluous (we could just hardcode it 
everywhere as the only possible value for "true"), but without it, the 
new form would look even more awkward. Suggestions welcome.

--Dmitry