[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue of 'gitlog-to-changelog' due to 'git rev-parse'
From: |
Stefan Vargyas |
Subject: |
Re: Issue of 'gitlog-to-changelog' due to 'git rev-parse' |
Date: |
Fri, 8 Jul 2016 01:28:56 -0700 |
> Date: Mon, 4 Jul 2016 13:03:31 -0700
> From: Stefan Vargyas <address@hidden>
> Subject: Re: Re: Issue of 'gitlog-to-changelog' due to 'git rev-parse'
>
...
>
> Pádraig,
>
> Thank you for your response.
>
> Indeed you raised a good point:
>
> $ mkdir -vp /tmp/foo/bar
> mkdir: created directory `/tmp/foo'
> mkdir: created directory `/tmp/foo/bar'
> $ (cd /tmp/foo && git init)
> Initialized empty Git repository in /tmp/foo/.git/
>
> $ ./git-dir /tmp/foo
> target: /tmp/foo
> from git: .git
> from abs_path: /tmp/foo/.git
> $ ./git-dir /tmp/foo/bar
> target: /tmp/foo/bar
> from git: /tmp/foo/.git
> from abs_path: /tmp/foo/.git
>
> $ alias git-dir="`pwd`/git-dir"
>
> $ (cd /tmp && git-dir foo)
> target: foo
> from git: .git
> from abs_path: /tmp/foo/.git
> $ (cd /tmp && git-dir foo/bar)
> target: foo/bar
> from git: /tmp/foo/.git
> from abs_path: /tmp/foo/.git
>
> Therefore, I propose a new patch for you to scrutinize.
>
> Stefan V.
>
>
Pádraig,
The man page of git-rev-parse and the git source code itself
show that the above patched gitlog-to-changelog would not
function as expected had the user defined $GIT_DIR prior to
calling the perl script.
This is due to the fact that `--git-dir' gets back $GIT_DIR
if defined, instead of the path to the .git directory of the
current repo:
$ mkdir -vp /tmp/{foo,bar}
mkdir: created directory `/tmp/foo'
mkdir: created directory `/tmp/bar'
$ (cd /tmp/foo && git init)
Initialized empty Git repository in /tmp/foo/.git/
$ GIT_DIR=/tmp/bar ./git-dir /tmp/foo
fatal: Not a git repository: '/tmp/bar'
git-dir: error: 'git rev-parse --git-dir' had unexpected \
exit code or signal (32768)
The modified git-dir attached deletes the environment var
$GIT_DIR prior to calling git-rev-parse.
$ GIT_DIR=/tmp/bar ./git-dir-2 /tmp/foo
target: /tmp/foo
from git: .git
from abs_path: /tmp/foo/.git
The patch of gitlog-to-changelog is updated accordingly.
Sincerely,
Stefan V.
gitlog-to-changelog-3.patch.gz
Description: Binary data
git-dir-2.gz
Description: Binary data