bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/2] gitlog-to-changelog output adjustments


From: Jim Meyering
Subject: Re: [PATCH 0/2] gitlog-to-changelog output adjustments
Date: Sun, 30 Oct 2011 20:19:43 +0100

Dmitry V. Levin wrote:
> After migrating several projects from GNU-Style ChangeLogs to git with
> autogenerated ChangeLog files, I found a minor discrepancy in style

Hi Dmitry,

If they're using gnulib but not listed in users.txt, please
add their names/URLs.  Keeping that list up to date helps us
e.g., when contemplating gnulib changes, we can quickly survey how
each of those client projects is using it.

> between the old and generated ChangeLog files.  The git commit message
> convention is that the first line of a commit message is a summary which
> is usually not terminated with a dot.  As result, gitlog-to-changelog
> produces a strange mix of not dot-terminated sentences and
> dot-terminated ChangeLogs entries, which looks quite unlike old
> ChangeLog files where every sentence used to be dot-terminated.
>
> I suggest the following adjustments to gitlog-to-changelog output:
>
>  gitlog-to-changelog: treat messages without non-blank lines as empty
>  gitlog-to-changelog: terminate the 1st line of commit message with a dot
>
>  ChangeLog                     |   12 ++++++++++++
>  build-aux/gitlog-to-changelog |   10 +++++++---
>  2 files changed, 19 insertions(+), 3 deletions(-)

I see where you're coming from, and if you make each summary line
start with a capital letter, like a regular sentence, then that makes
sense.  However, at least in projects I maintain, I don't capitalize
that way, and deliberately avoid the trailing ".", too.
Sometimes, when I can't fit a description on that first line,
I write part of it, and then a comma, and continue with the summary
in the body of the message.  So maybe you want to append the "."
only if there is no other punctuation at the end.

Given the lack of leading capital letters in my summary "sentences",
I am reluctant to append a trailing period even in the generated ChangeLog.
However, if you want to add an option to enable the suggested behavior,
that would work.

Also, if that first line is of length 72, or maybe even 71, some may
not want to add that period, since with the ChangeLog's leading TAB,
it might make it wrap.

Thanks for the fix in 1/2, I've adjusted it to avoid the
double negative in the logs:

  -       gitlog-to-changelog: treat messages without non-blank lines as empty
  +       gitlog-to-changelog: treat a message with only blank lines as empty


>From 92822428a2739c16caf12e75a4bba24258da3ec3 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <address@hidden>
Date: Sun, 30 Oct 2011 05:01:00 +0400
Subject: [PATCH] gitlog-to-changelog: treat a message with only blank lines
 as empty

* build-aux/gitlog-to-changelog: Move the code that removes leading and
trailing blank lines before the code that issues a warning about an
empty commit message.
---
 ChangeLog                     |    7 +++++++
 build-aux/gitlog-to-changelog |    8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 603a16f..30cc2af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-29  Dmitry V. Levin  <address@hidden>
+
+       gitlog-to-changelog: treat a message with only blank lines as empty.
+       * build-aux/gitlog-to-changelog: Move the code that removes leading and
+       trailing blank lines before the code that issues a warning about an
+       empty commit message.
+
 2011-10-30  Jim Meyering  <address@hidden>

        test-parse-datetime.c: avoid new DST-related false positive test failure
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 4559704..a5fd80d 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -152,6 +152,10 @@ 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)
         {
@@ -159,10 +163,6 @@ sub quoted_cmd(@)
         }
       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;

--
1.7.7.1.476.g9890



reply via email to

[Prev in Thread] Current Thread [Next in Thread]