From 63209fe8f7f148934e0c69036229ac54eaa42891 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 10 Dec 2017 05:56:22 -0700 Subject: [PATCH] Treat a blank line in a commit message as a line break. There doesn't appear to be a way to make perl's format use a blank field but at least the line break happens now. --- log2cl.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/log2cl.pl b/log2cl.pl index efae9e211..de3502d7a 100755 --- a/log2cl.pl +++ b/log2cl.pl @@ -19,7 +19,7 @@ use warnings; -my $format="%ad %aN <%aE>%n%h%n%s%n%b%nFILES:"; +my $format="%ad %aN <%aE>%n%h%n%B%nFILES:"; my @cmd = ("git", "log", "--log-size", "--name-only", "--date=short", "--format=$format", @ARGV); open(LOG, '-|', @cmd) || die "$0: unable to run git log: $!"; @@ -62,8 +62,9 @@ while () { $hash = $_; $state++; } elsif ($state == 2) { - # message body + # multi-line message body if (defined($body)) { + $_ = "\r" if $_ eq ""; $body .= " $_"; } else { $body = $_; @@ -95,7 +96,7 @@ sub print_entry $files ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ $body - ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + @* $hash . -- 2.40.0