* git rev-parse --git-dir does report yield relative path to git directory, per documentation
@ 2012-05-17 9:03 Jon Seymour
2012-05-17 16:38 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Jon Seymour @ 2012-05-17 9:03 UTC (permalink / raw)
To: Git Mailing List
Per this advice in git-rev-parse(1):
Show $GIT_DIR if defined. Otherwise show the path to the .git
directory, relative to the current directory.
I had expected this:
cd /tmp &&
rm -rf foobar &&
mkdir foobar &&
cd foobar &&
git init &&
mkdir tmp &&
:> tmp/.gitignore &&
git add tmp &&
cd tmp &&
git rev-parse --git-dir
to report:
Initialized empty Git repository in /tmp/foobar/.git/
../.git
but in actual fact it reports:
Initialized empty Git repository in /tmp/foobar/.git/
/tmp/foobar/.git
git version 1.7.10.1.514.ge33c7ea
Am I misunderstanding the meaning of the term "relative" in quote above?
jon.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: git rev-parse --git-dir does report yield relative path to git directory, per documentation 2012-05-17 9:03 git rev-parse --git-dir does report yield relative path to git directory, per documentation Jon Seymour @ 2012-05-17 16:38 ` Junio C Hamano 2012-05-17 18:23 ` Jonathan Nieder 0 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2012-05-17 16:38 UTC (permalink / raw) To: Jon Seymour Cc: Git Mailing List, Jonathan Nieder, Nguyễn Thái Ngọc Duy Jon Seymour <jon.seymour@gmail.com> writes: > Per this advice in git-rev-parse(1): > > Show $GIT_DIR if defined. Otherwise show the path to the .git > directory, relative to the current directory. > ... Unfortunate. Here is what the commit that wrote the sentence says: commit 80d868b068b9e68a4aac91be578a8f097f45d8da Author: Jonathan Nieder <jrnieder@gmail.com> Date: Fri Nov 26 22:32:31 2010 +0700 git-rev-parse.txt: clarify --git-dir The current behavior is often to print an absolute path rather than a ../../etc string, but callers must be ready to accept a relative path, too. The most common output is ".git" (from the toplevel of an ordinary work tree). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> I am not sure what we were smoking. I am guessing that it wanted to say that the path is something you can feed to chdir(2) to go there, but it should have done so without promising more than what it does. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git rev-parse --git-dir does report yield relative path to git directory, per documentation 2012-05-17 16:38 ` Junio C Hamano @ 2012-05-17 18:23 ` Jonathan Nieder 2012-05-18 9:23 ` [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths Jon Seymour 0 siblings, 1 reply; 7+ messages in thread From: Jonathan Nieder @ 2012-05-17 18:23 UTC (permalink / raw) To: Junio C Hamano Cc: Jon Seymour, Git Mailing List, Nguyễn Thái Ngọc Duy Hi, Junio C Hamano wrote: > Jon Seymour <jon.seymour@gmail.com> writes: >> Per this advice in git-rev-parse(1): >> >> Show $GIT_DIR if defined. Otherwise show the path to the .git >> directory, relative to the current directory. >> ... [...] > I am not sure what we were smoking. Yeah, that text is pretty confusing. Thanks for finding it. The intent was: Show the path to the git repository database (usually $GIT_DIR or ".git"). When relative, this path is relative to the current directory. The point of that last part is that this is relative to the cwd when rev-parse is called and not relative to the top level of the worktree. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths 2012-05-17 18:23 ` Jonathan Nieder @ 2012-05-18 9:23 ` Jon Seymour 2012-05-18 9:31 ` Jonathan Nieder 2012-05-18 10:23 ` Nguyen Thai Ngoc Duy 0 siblings, 2 replies; 7+ messages in thread From: Jon Seymour @ 2012-05-18 9:23 UTC (permalink / raw) To: git; +Cc: gitster, jrnieder, pclouds, Jon Seymour The previous documentation was misleading because it lead the reader to believe that --git-dir would always show a relative path when, in fact, the actual behaviour does not guarantee this. Rather, it was intended that the advice be given that if a relative path is shown, then the path is relative to the current working directory and not some other directory (for example, the root of the working tree). Signed-off-by: Jon Seymour <jon.seymour@gmail.com> --- Documentation/git-rev-parse.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index f63b81a..4cc3e95 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -137,7 +137,8 @@ shown. If the pattern does not contain a globbing character (`?`, --git-dir:: Show `$GIT_DIR` if defined. Otherwise show the path to - the .git directory, relative to the current directory. + the .git directory. The path shown, when relative, is + relative to the current working directory. + If `$GIT_DIR` is not defined and the current directory is not detected to lie in a git repository or work tree -- 1.7.10.1.514.ge33c7ea ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths 2012-05-18 9:23 ` [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths Jon Seymour @ 2012-05-18 9:31 ` Jonathan Nieder 2012-05-18 19:24 ` Junio C Hamano 2012-05-18 10:23 ` Nguyen Thai Ngoc Duy 1 sibling, 1 reply; 7+ messages in thread From: Jonathan Nieder @ 2012-05-18 9:31 UTC (permalink / raw) To: Jon Seymour; +Cc: git, gitster, pclouds Jon Seymour wrote: > --- a/Documentation/git-rev-parse.txt > +++ b/Documentation/git-rev-parse.txt > @@ -137,7 +137,8 @@ shown. If the pattern does not contain a globbing character (`?`, > > --git-dir:: > Show `$GIT_DIR` if defined. Otherwise show the path to > - the .git directory, relative to the current directory. > + the .git directory. The path shown, when relative, is > + relative to the current working directory. > + > If `$GIT_DIR` is not defined and the current directory > is not detected to lie in a git repository or work tree Thanks for taking care of it. I suppose I'd have used a subject line like the following for brevity. rev-parse doc: --git-dir does not always show a relative path For what it's worth, with or without that change, Acked-by: Jonathan Nieder <jrnieder@gmail.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths 2012-05-18 9:31 ` Jonathan Nieder @ 2012-05-18 19:24 ` Junio C Hamano 0 siblings, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2012-05-18 19:24 UTC (permalink / raw) To: Jonathan Nieder; +Cc: Jon Seymour, git, pclouds Thanks, both. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths 2012-05-18 9:23 ` [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths Jon Seymour 2012-05-18 9:31 ` Jonathan Nieder @ 2012-05-18 10:23 ` Nguyen Thai Ngoc Duy 1 sibling, 0 replies; 7+ messages in thread From: Nguyen Thai Ngoc Duy @ 2012-05-18 10:23 UTC (permalink / raw) To: Jon Seymour; +Cc: git, gitster, jrnieder On Fri, May 18, 2012 at 4:23 PM, Jon Seymour <jon.seymour@gmail.com> wrote: > @@ -137,7 +137,8 @@ shown. If the pattern does not contain a globbing character (`?`, > > --git-dir:: > Show `$GIT_DIR` if defined. Otherwise show the path to > - the .git directory, relative to the current directory. > + the .git directory. The path shown, when relative, is > + relative to the current working directory. > + > If `$GIT_DIR` is not defined and the current directory > is not detected to lie in a git repository or work tree Definitely an improvement. Thanks. -- Duy ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-18 19:24 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-05-17 9:03 git rev-parse --git-dir does report yield relative path to git directory, per documentation Jon Seymour 2012-05-17 16:38 ` Junio C Hamano 2012-05-17 18:23 ` Jonathan Nieder 2012-05-18 9:23 ` [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths Jon Seymour 2012-05-18 9:31 ` Jonathan Nieder 2012-05-18 19:24 ` Junio C Hamano 2012-05-18 10:23 ` Nguyen Thai Ngoc Duy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox