git-remote-mediawiki: don't compute the diff when getting commit message
While we're there, simplify the code a bit: since log --format=%s anyway shows the subject line as a single line, no need to split to take the first line. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthieu Moy committed
Jun 27, 2012 at 11:10 UTC
28c24bd7253c3c7a4f3134c5bae4d039b9838e87
1 file changed
+2
-2
contrib/mw-to-git/git-remote-mediawiki
+2
-2
@@ -873,8 +873,8 @@ sub mw_push_revision {
873
# TODO: we could detect rename, and encode them with a #redirect on the wiki.
874
# TODO: for now, it's just a delete+add
875
my @diff_info_list = split(/\0/, $diff_infos);
876
- # Keep the first line of the commit message as mediawiki comment for the revision
877
- my $commit_msg = (split(/\n/, run_git("show --pretty=format:\"%s\" $sha1_commit")))[0];
876
+ # Keep the subject line of the commit message as mediawiki comment for the revision
877
+ my $commit_msg = run_git("log --no-walk --format=\"%s\" $sha1_commit");
878
chomp($commit_msg);
879
# Push every blob
880
while (@diff_info_list) {