summaryrefslogtreecommitdiff
path: root/build-aux/gitlog-to-changelog
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-17 16:20:52 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-17 16:20:52 +0100
commit7ae4e75af5366086e60fbc2e9454dfd9e5965102 (patch)
tree61ea2340323e17e362de7860824917d3eeb66abd /build-aux/gitlog-to-changelog
parent44cd55752aad2a69e1583a2cb37c3b98c5c44ad3 (diff)
downloadguile-7ae4e75af5366086e60fbc2e9454dfd9e5965102.tar.gz
Update Gnulib to v0.0-7695-g26c0590.
* gnulib-local/m4/canonicalize.m4.diff: Remove. * Makefile.am (EXTRA_DIST): Adjust accordingly.
Diffstat (limited to 'build-aux/gitlog-to-changelog')
-rwxr-xr-xbuild-aux/gitlog-to-changelog35
1 files changed, 32 insertions, 3 deletions
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 17c456271..5184edc7d 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-05-22 09:40'; # UTC
+my $VERSION = '2012-07-29 06:11'; # 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
@@ -68,6 +68,8 @@ OPTIONS:
header; the default is to cluster adjacent commit messages
if their headers are the same and neither commit message
contains multiple paragraphs.
+ --srcdir=DIR the root of the source tree, from which the .git/
+ directory can be derived.
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--format=FMT set format string for commit subject and body;
@@ -192,6 +194,30 @@ sub parse_amend_file($)
return $h;
}
+# git_dir_option $SRCDIR
+#
+# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
+# is undef). Return as a list (0 or 1 element).
+sub git_dir_option($)
+{
+ my ($srcdir) = @_;
+ my @res = ();
+ if (defined $srcdir)
+ {
+ my $qdir = shell_quote $srcdir;
+ my $cmd = "cd $qdir && git rev-parse --show-toplevel";
+ my $qcmd = shell_quote $cmd;
+ my $git_dir = qx($cmd);
+ defined $git_dir
+ or die "$ME: cannot run $qcmd: $!\n";
+ $? == 0
+ or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
+ chomp $git_dir;
+ push @res, "--git-dir=$git_dir/.git";
+ }
+ @res;
+}
+
{
my $since_date;
my $format_string = '%s%n%b%n';
@@ -200,6 +226,7 @@ sub parse_amend_file($)
my $cluster = 1;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
+ my $srcdir;
GetOptions
(
help => sub { usage 0 },
@@ -211,9 +238,9 @@ sub parse_amend_file($)
'cluster!' => \$cluster,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
+ 'srcdir=s' => \$srcdir,
) or usage 1;
-
defined $since_date
and unshift @ARGV, "--since=$since_date";
@@ -221,7 +248,9 @@ sub parse_amend_file($)
# that makes a correction in the log or attribution of that commit.
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
- my @cmd = (qw (git log --log-size),
+ my @cmd = ('git',
+ git_dir_option $srcdir,
+ qw(log --log-size),
'--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
open PIPE, '-|', @cmd
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"