I've found that having a list of the patch subjects appended to the end of an existing --compose email is quite useful. I've tried to make appending smart enough not to alter existing lines beyond the addition of some kind of newline. Signed-off-by: Michael Witten <mfwitten@xxxxxxxxx> --- Documentation/git-send-email.txt | 3 ++- git-send-email.perl | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 5ef8b12..6edef52 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -61,7 +61,8 @@ The --cc option must be repeated for each user you want on the cc list. `$GIT_EDITOR`, 'core.editor', `$VISUAL`, `$EDITOR`, or `vi`. + A path for the composition may be given. If the path exists, then -the file at the path is opened for editing as-is. If the path +the file at the path is opened for editing with the list of patch +subjects (prefixed with 'GIT: ') appended to the end. If the path doesn't exist, a file with default content is created at the path and opened for editing. If no path is specified, a new temporary file with default content is created and opened for editing. diff --git a/git-send-email.perl b/git-send-email.perl index 2ab76c6..696b132 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -644,9 +644,25 @@ if (defined $compose) { print "GIT: This is the first line of the <body>:\n"; print "\n"; - for my $f (@files) { - print get_patch_subject($f); + print get_patch_subject($_) for (@files); + + } else { + + # Supply a listing of the patch subjects, in case + # it might be useful to the user: + + open $compose_path_filehandle, "+<", $compose_path + or die "--compose: Could not open '$compose_path' for appending listing: $!\n"; + + # Figure out whether we should begin a new line + # (we don't want to append to an existing line): + + if (seek $compose_path_filehandle, -1, 2) { + read $compose_path_filehandle, my $c, 1; + $c !~ /\n|\r/ and print $compose_path_filehandle "\n"; } + + print $compose_path_filehandle get_patch_subject($_) for (@files); } # Do the editing: -- 1.6.2.2.479.g2aec -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html