If builddir is not a subdirectory of srcdir, running git from it will fail.
* build-aux/gitlog-to-changelog (--git-dir): New option. --- ChangeLog | 7 +++++++ build-aux/gitlog-to-changelog | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) Hi all, This patch should help people who, like me, sometimes build from /tmp for instance, while the sources are in /home. Cheers, Akim diff --git a/ChangeLog b/ChangeLog index a0fa30a..6811333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-07-15 Akim Demaille <a...@lrde.epita.fr> + + gitlog-to-changelog: VPATH build issues + If builddir is not a subdirectory of srcdir, running git from it will + fail. + * build-aux/gitlog-to-changelog (--git-dir): New option. + 2012-07-15 Jim Meyering <meyer...@redhat.com> maint: require that each sc_... command start with "@" diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 17c4562..3f285a5 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -68,6 +68,7 @@ OPTIONS: header; the default is to cluster adjacent commit messages if their headers are the same and neither commit message contains multiple paragraphs. + --git-dir=DIR set the path to the Git repository. --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; @@ -200,6 +201,7 @@ sub parse_amend_file($) my $cluster = 1; my $strip_tab = 0; my $strip_cherry_pick = 0; + my $git_dir; GetOptions ( help => sub { usage 0 }, @@ -211,9 +213,9 @@ sub parse_amend_file($) 'cluster!' => \$cluster, 'strip-tab' => \$strip_tab, 'strip-cherry-pick' => \$strip_cherry_pick, + 'git-dir=s' => \$git_dir, ) or usage 1; - defined $since_date and unshift @ARGV, "--since=$since_date"; @@ -221,7 +223,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', + defined $git_dir ? ("--git-dir=$git_dir") : (), + 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" -- 1.7.11.2