chiark / gitweb /
Quilt output: Normalise trailing newlines in commit message
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 836e19d4257173a9fe046781500e3cef0c2f0855..4b593fce78907ebcc9ab6ea95cb98461d68bb87e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3973,8 +3973,14 @@ sub quiltify ($$$$) {
        $commitdata =~ m/^author (.*) \d+ [-+0-9]+$/m or die "$cc ?";
        my $author = $1;
 
+       my $commitdate = cmdoutput
+           @git, qw(log -n1 --pretty=format:%aD), $cc;
+
        $msg =~ s/^(.*)\n*/$1\n/ or die "$cc $msg ?";
 
+       my $strip_nls = sub { $msg =~ s/\n+$//; $msg .= "\n"; };
+       $strip_nls->();
+
        my $title = $1;
        my $patchname = $title;
        $patchname =~ s/[.:]$//;
@@ -3999,6 +4005,7 @@ sub quiltify ($$$$) {
        runcmd @git, qw(checkout -q), $target, qw(debian/changelog);
 
        quiltify_dpkg_commit "$patchname$index", $author, $msg,
+           "Date: $commitdate\n".
            "X-Dgit-Generated: $clogp->{Version} $cc\n";
 
        runcmd @git, qw(checkout -q), $cc, qw(debian/changelog);