X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=build-aux%2Fgitlog-to-changelog;h=1cc53eb7c1036ce93c77c4e0830cf573d0dd928b;hb=296de1083182be81806ba8954f05377308fa3eaa;hp=3efdb6ddbb0eccba4561b4c0f864ab754a9b4d36;hpb=acdd5946e05fd351eca750cc7a1ef4fd5a158f72;p=gnulib.git diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 3efdb6ddb..1cc53eb7c 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -1,13 +1,13 @@ #!/usr/bin/perl # Convert git log output to ChangeLog format. -my $VERSION = '2008-02-10 10:03'; # UTC +my $VERSION = '2009-06-04 08:53'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -50,9 +50,11 @@ sub usage ($) else { print $STREAM < ChangeLog + $ME -- -n 5 foo > last-5-commits-to-branch-foo EOF } @@ -100,13 +103,11 @@ sub quoted_cmd(@) 'since=s' => \$since_date, ) or usage 1; - @ARGV - and (warn "$ME: too many arguments\n"), usage 1; - my @cmd = (qw (git log --log-size), "--since=$since_date", - '--pretty=format:%ct %an <%ae>%n%n%s%n%b%n'); + '--pretty=format:%ct %an <%ae>%n%n%s%n%b%n', @ARGV); open PIPE, '-|', @cmd - or die "$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n"; + or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n" + . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); my $prev_date_line = ''; while (1) @@ -144,14 +145,22 @@ sub quoted_cmd(@) # Omit "Signed-off-by..." lines. @line = grep !/^Signed-off-by: .*>$/, @line; - # Remove leading and trailing blank lines. - while ($line[0] =~ /^\s*$/) { shift @line; } - while ($line[$#line] =~ /^\s*$/) { pop @line; } + # If there were any lines + if (@line == 0) + { + warn "$ME: warning: empty commit message:\n $date_line\n"; + } + else + { + # Remove leading and trailing blank lines. + while ($line[0] =~ /^\s*$/) { shift @line; } + while ($line[$#line] =~ /^\s*$/) { pop @line; } - # Prefix each non-empty line with a TAB. - @line = map { length $_ ? "\t$_" : '' } @line; + # Prefix each non-empty line with a TAB. + @line = map { length $_ ? "\t$_" : '' } @line; - print "\n", join ("\n", @line), "\n"; + print "\n", join ("\n", @line), "\n"; + } defined ($in = ) or last;