bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] gitlog-to-changelog pass args to git-log


From: William Pursell
Subject: Re: [PATCH] gitlog-to-changelog pass args to git-log
Date: Sun, 21 Dec 2008 11:46:16 +0000
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

>From 756fa7c0a87eca7ecfebdb1c46b25bd776b4ec01 Mon Sep 17 00:00:00 2001
From: William Pursell <address@hidden>
Date: Sun, 21 Dec 2008 11:24:13 +0000
Subject: [PATCH] Pass options to git-log via gitlog-to-changelog

When producing a ChangeLog, it is sometimes convenient
to filter the commits in various ways.  gitlog-to-changelog
only allows --since to specify a start date, but git-log
itself supports many other filtering mechanisms.  At the
moment, I want to filter by branch name.  Rather than adding
a --branch option to gitlog-to-changelog, it seems more
flexible to simply pass all options directly to git-log
and let git do the work.  Notice that this effectively
makes --since a redundant option for gitlog-to-changelog,
but removing it would require current usage to change since
calls would then require an additional '--'.
---

changes since 1st patch:
  more documentation, mentioning '--' explicitly
  simpler implementation avoiding unnecessary foreach loop

 build-aux/gitlog-to-changelog |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 50b1b2f..45c82ad 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -50,9 +50,11 @@ sub usage ($)
   else
     {
       print $STREAM <<EOF;
-Usage: $ME [OPTIONS]
+Usage: $ME [OPTIONS] [ARGS]

-Convert git log output to ChangeLog format.
+Convert git log output to ChangeLog format.  If present, any ARGS
+are passed to git-log.  To avoid ARGS being parsed as options to
+$ME, they may be preceded by '--'.

 OPTIONS:

@@ -65,6 +67,7 @@ OPTIONS:
 EXAMPLE:

   $ME --since=2008-01-01 > ChangeLog
+  $ME -- -n 5 foo > last-5-commits-to-branch-foo

 EOF
     }
@@ -100,11 +103,8 @@ 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"
             . "(Is your Git too old?  Version 1.5.1 or later is required.)\n");
-- 
1.6.1.rc2.306.ge5d5e.dirty



-- 
William Pursell




reply via email to

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