bug-gnulib
[Top][All Lists]
Advanced

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

improve error message from gitlog-to-changelog with too-old Git


From: Ben Pfaff
Subject: improve error message from gitlog-to-changelog with too-old Git
Date: Mon, 18 Aug 2008 22:06:16 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

GNU PSPP has started using the gitlog-to-changelog script, via
the corresponding gnulib module.  One of the PSPP developers
(CC'd) reported the following error from the script:

> fatal: invalid --pretty format: format:%ct  %an  <%ae>%n%n%s%n%b%n
> gitlog-to-changelog: error closing pipe from git log --log-size
>           '--since=2008-07-27' '--pretty=format:%ct  %an
>           <%ae>%n%n%s%n%b%n'

Later, he noticed:
> It seems to work OK with git 1.5.5.3 but not with git 1.4.4.4 

Looking at Git's history, "--pretty=format:" was introduced
between Git 1.5.0 and 1.5.1, so I'd propose helping the user to
understand what went wrong with the following change.

Alternatively, one could check the Git version number before
trying "--pretty=format:", but this seems to require parsing the
output of "git --version" and I'm not too enthusiastic about
various things that can go wrong with that.

2008-08-18  Ben Pfaff  <address@hidden>

        * build-aux/gitlog-to-changelog: Improve error message given when
        the available version of Git is too old.

diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 3efdb6d..50b1b2f 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # Convert git log output to ChangeLog format.
 
-my $VERSION = '2008-02-10 10:03'; # UTC
+my $VERSION = '2008-08-19 05:01'; # 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
@@ -106,7 +106,8 @@ sub quoted_cmd(@)
   my @cmd = (qw (git log --log-size), "--since=$since_date",
              '--pretty=format:%ct  %an  <%ae>%n%n%s%n%b%n');
   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)

Thanks,

Ben.
-- 
"Premature optimization is the root of all evil."
--D. E. Knuth, "Structured Programming with go to Statements"




reply via email to

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