From: Junio C Hamano <gitster@pobox.com>
To: Mike Rappazzo <rappazzo@gmail.com>
Cc: "Git List" <git@vger.kernel.org>, "Nguyễn Thái Ngọc" <pclouds@gmail.com>
Subject: Re: [Bug] git rev-parse --git-common-dir executed from a sub dir of the main worktree is wrong
Date: Mon, 28 Mar 2016 12:57:52 -0700 [thread overview]
Message-ID: <xmqqk2kmxtmn.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CANoM8SU4ZWA=f1TSmNbHDBut7ox6cCVoi3K37GEmjHvygw1odg@mail.gmail.com> (Mike Rappazzo's message of "Mon, 28 Mar 2016 15:43:59 -0400")
Mike Rappazzo <rappazzo@gmail.com> writes:
> I found a case where it seems that the result of `git rev-parse
> --git-common-dir` is incorrect. If you execute the command from
> within a subdirectory in the main worktree, it returns the path from
> the root of the worktree to the current dir + "/.git". (As a
> refresher, running this command from the root of the worktree returns
> ".git").
>
> I wrote a quick test to demonstrate the problem:
>
>
> +test_expect_success 'git-common-dir inside sub-dir' '
> + (
> + mkdir -p path/to/child &&
> + cd path/to/child &&
> + echo "$(git rev-parse --show-toplevel)/.git" >expected &&
... or
"$(git rev-parse --show-cdup).git >expect
i.e. to use relative path, just like the case where you start from
the top.
> + git rev-parse --git-common-dir >actual &&
> + test_cmp expected actual
> + )
> +'
> +
>
> I suggest that we change the result of this call to _always_ return an
> absolute path.
prev parent reply other threads:[~2016-03-28 19:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-28 19:43 [Bug] git rev-parse --git-common-dir executed from a sub dir of the main worktree is wrong Mike Rappazzo
2016-03-28 19:57 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk2kmxtmn.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=rappazzo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).