bug-gnulib
[Top][All Lists]
Advanced

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

Re: Issue of 'gitlog-to-changelog' due to 'git rev-parse'


From: Pádraig Brady
Subject: Re: Issue of 'gitlog-to-changelog' due to 'git rev-parse'
Date: Mon, 4 Jul 2016 18:34:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 04/07/16 09:55, Stefan Vargyas wrote:
> Dear maintainers,
> 
> While using gnulib's gitlog-to-changelog perl script, I came
> across the following issue it has:
> 
> Older versions of 'git rev-parse' does not have the command
> line option `--show-toplevel'. In this case the perl script
> fails badly, as shown by the sequence of commands below:
> 
>   $ mkdir -v /tmp/foo
>   mkdir: created directory `/tmp/foo'
> 
>   $ (cd /tmp/foo && git init)
>   Initialized empty Git repository in /tmp/foo/.git/
> 
>   $ gitlog-to-changelog --srcdir=/tmp/foo
>   fatal: Not a git repository: '--show-toplevel/.git'
>   gitlog-to-changelog: error closing pipe from git \
> '--git-dir=--show-toplevel/.git' log --log-size  \
> '--pretty=format:%H:%ct  %an  <%ae>%n%n%s%n%b%n'
> 
> This boils down to 'git rev-parse' not returning an error
> condition when passed to it the option `--show-toplevel'
> which it does not know (for example in case of git version
> 1.6.0.2):
> 
>   $ git rev-parse --help|grep -e --show-toplevel -c
>   0
> 
>   $ rm -rf /tmp/foo
>   $ mkdir -v /tmp/foo
>   mkdir: created directory `/tmp/foo'
> 
>   $ git-rev-parse() { (cd /tmp/foo && git rev-parse "$@" ; echo $?); }
> 
>   $ git-rev-parse --show-toplevel
>   fatal: Not a git repository
>   128
>   $ git-rev-parse --git-dir
>   fatal: Not a git repository
>   128
> 
>   $ (cd /tmp/foo && git init)
>   Initialized empty Git repository in /tmp/foo/.git/
> 
>   $ git-rev-parse --show-toplevel
>   --show-toplevel
>   0
>   $ git-rev-parse --git-dir
>   .git 
>   0
> 
>   $ rm -rf /tmp/foo
>   $ mkdir -v /tmp/foo
>   mkdir: created directory `/tmp/foo'
>   $ (cd /tmp/foo && git init --bare)
>   Initialized empty Git repository in /tmp/foo/
> 
>   $ git-rev-parse --show-toplevel
>   --show-toplevel
>   0
>   $ git-rev-parse --git-dir
>   .
>   0
> 
> Fixing the perl script was immediate: use `--git-dir' instead
> of the potentially not implemented `--show-toplevel'. Please
> see the patch file attached.

thanks for the fix.
I see that --git-dir can return relative or absolute results
(if invoked in subdir of repo for example).
Do we need special handling for returned absolute results?

cheers,
Pádraig



reply via email to

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