Joel E. Denny wrote: > On Tue, 17 Jan 2012, Jim Meyering wrote: > >> > Below is a patch that adds a --no-cluster option, which I believe does >> > what Stefano wants. I want it too. OK to push? >> >> Hi Joel, >> >> Thanks. That looks fine, but please adjust the preceding comment >> to keep in sync with the new behavior. > > Thanks. I folded in the following and pushed. > > diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog ... > + # then print the header. > if ($no_cluster > or $date_line ne $prev_date_line > or "@coauthors" ne "@prev_coauthors"
Thanks. I noticed those in-expression uses of "or" ("misuses", IMHO -- though it's mainly style) in the context of your change, so the first patch below switches them to "||". The second uses Getopt::Long's "!" boolean attribute rather than a literal "no-". I remembered that only after you'd pushed. >From b1028f1399dc471db8f777cec6182b5d9a456541 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Wed, 18 Jan 2012 08:45:29 +0100 Subject: [PATCH 1/2] gitlog-to-changelog: use "||", not "or" in expressions * build-aux/gitlog-to-changelog (main): Use "||", not "or" in expressions. --- ChangeLog | 6 ++++++ build-aux/gitlog-to-changelog | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b225cf1..c7bee91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-01-18 Jim Meyering <meyer...@redhat.com> + + gitlog-to-changelog: use "||", not "or" in expressions + * build-aux/gitlog-to-changelog (main): Use "||", not "or" in + expressions. + 2012-01-17 Joel E. Denny <joelde...@joeldenny.org> gitlog-to-changelog: new option --no-cluster diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 61edde1..099ecdd 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' if 0; # Convert git log output to ChangeLog format. -my $VERSION = '2012-01-17 21:54'; # UTC +my $VERSION = '2012-01-18 07:44'; # 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 @@ -313,10 +313,10 @@ sub parse_amend_file($) # or if this or the previous entry consists of two or more paragraphs, # then print the header. if ($no_cluster - or $date_line ne $prev_date_line - or "@coauthors" ne "@prev_coauthors" - or $multi_paragraph - or $prev_multi_paragraph) + || $date_line ne $prev_date_line + || "@coauthors" ne "@prev_coauthors" + || $multi_paragraph + || $prev_multi_paragraph) { $prev_date_line eq '' or print "\n"; -- 1.7.9.rc1.2.gccfe4 >From b891bc2c0bd3f9cd65fac6793160c49da813220e Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Wed, 18 Jan 2012 08:53:23 +0100 Subject: [PATCH 2/2] gitlog-to-changelog: don't use "no_"-prefixed variable name * build-aux/gitlog-to-changelog (main): Use getopt's "!" attribute to enable both --cluster and --no-cluster. Change variable name, s/\$no_cluster/$cluster/, and reverse usage to match. --- ChangeLog | 5 +++++ build-aux/gitlog-to-changelog | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7bee91..dc34bb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2012-01-18 Jim Meyering <meyer...@redhat.com> + gitlog-to-changelog: don't use "no_"-prefixed variable name + * build-aux/gitlog-to-changelog (main): Use getopt's "!" attribute + to enable both --cluster and --no-cluster. Change variable name, + s/\$no_cluster/$cluster/, and reverse usage to match. + gitlog-to-changelog: use "||", not "or" in expressions * build-aux/gitlog-to-changelog (main): Use "||", not "or" in expressions. diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 099ecdd..38c6f3a 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' if 0; # Convert git log output to ChangeLog format. -my $VERSION = '2012-01-18 07:44'; # UTC +my $VERSION = '2012-01-18 07:50'; # 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 @@ -194,7 +194,7 @@ sub parse_amend_file($) my $format_string = '%s%n%b%n'; my $amend_file; my $append_dot = 0; - my $no_cluster = 0; + my $cluster = 1; GetOptions ( help => sub { usage 0 }, @@ -203,7 +203,7 @@ sub parse_amend_file($) 'format=s' => \$format_string, 'amend=s' => \$amend_file, 'append-dot' => \$append_dot, - 'no-cluster' => \$no_cluster, + 'cluster!' => \$cluster, ) or usage 1; @@ -312,7 +312,7 @@ sub parse_amend_file($) # would be different from the previous date/name/email/coauthors header, # or if this or the previous entry consists of two or more paragraphs, # then print the header. - if ($no_cluster + if ( ! $cluster || $date_line ne $prev_date_line || "@coauthors" ne "@prev_coauthors" || $multi_paragraph -- 1.7.9.rc1.2.gccfe4