{"thread":{"id":"30546","subject":"git rev-parse --git-dir does report yield relative path to git directory, per documentation","startedAt":"2012-05-17T09:03:28Z","lastAt":"2012-05-18T19:24:12Z","messageCount":7,"participants":["Jon Seymour","Junio C Hamano","Jonathan Nieder","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191622","messageId":"CAH3Anrrb243zdRJJEqDcWrHBVBDdYkGB=sTG7BbjTzsUHvWY-w@mail.gmail.com","threadId":"30546","inReplyTo":null,"subject":"git rev-parse --git-dir does report yield relative path to git directory, per documentation","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2012-05-17T09:03:28Z","receivedAt":"2012-05-17T09:03:28Z","isPatch":false,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Per this advice in git-rev-parse(1):\n\n     Show $GIT_DIR if defined. Otherwise show the path to the .git\ndirectory, relative to the current directory.\n\nI had expected this:\n\ncd /tmp &&\nrm -rf foobar &&\nmkdir foobar &&\ncd foobar &&\ngit init &&\nmkdir tmp &&\n:> tmp/.gitignore &&\ngit add tmp &&\ncd tmp &&\ngit rev-parse --git-dir\n\nto report:\n\nInitialized empty Git repository in /tmp/foobar/.git/\n../.git\n\nbut in actual fact it reports:\n\nInitialized empty Git repository in /tmp/foobar/.git/\n/tmp/foobar/.git\n\ngit version 1.7.10.1.514.ge33c7ea\n\nAm I misunderstanding the meaning of the term \"relative\" in quote above?\n\njon.\n"},{"id":"191629","messageId":"xmqqfwayrcen.fsf@junio.mtv.corp.google.com","threadId":"30546","inReplyTo":"CAH3Anrrb243zdRJJEqDcWrHBVBDdYkGB=sTG7BbjTzsUHvWY-w@mail.gmail.com","subject":"Re: git rev-parse --git-dir does report yield relative path to git directory, per documentation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-17T16:38:08Z","receivedAt":"2012-05-17T16:38:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> Per this advice in git-rev-parse(1):\n>\n>      Show $GIT_DIR if defined. Otherwise show the path to the .git\n> directory, relative to the current directory.\n> ...\n\nUnfortunate.  Here is what the commit that wrote the sentence says:\n\n    commit 80d868b068b9e68a4aac91be578a8f097f45d8da\n    Author: Jonathan Nieder <jrnieder@gmail.com>\n    Date:   Fri Nov 26 22:32:31 2010 +0700\n\n        git-rev-parse.txt: clarify --git-dir\n\n        The current behavior is often to print an absolute path rather than\n        a ../../etc string, but callers must be ready to accept a relative\n        path, too. The most common output is \".git\" (from the toplevel of\n        an ordinary work tree).\n\n        Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n        Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n        Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nI am not sure what we were smoking.  I am guessing that it wanted to say\nthat the path is something you can feed to chdir(2) to go there, but it\nshould have done so without promising more than what it does.\n"},{"id":"191630","messageId":"20120517182304.GA14367@burratino","threadId":"30546","inReplyTo":"xmqqfwayrcen.fsf@junio.mtv.corp.google.com","subject":"Re: git rev-parse --git-dir does report yield relative path to git directory, per documentation","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-05-17T18:23:04Z","receivedAt":"2012-05-17T18:23:04Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJunio C Hamano wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n\n>> Per this advice in git-rev-parse(1):\n>>\n>>      Show $GIT_DIR if defined. Otherwise show the path to the .git\n>> directory, relative to the current directory.\n>> ...\n[...]\n> I am not sure what we were smoking.\n\nYeah, that text is pretty confusing.  Thanks for finding it.\n\nThe intent was:\n\n\tShow the path to the git repository database (usually $GIT_DIR or\n\t\".git\").  When relative, this path is relative to the current\n\tdirectory.\n\nThe point of that last part is that this is relative to the cwd when\nrev-parse is called and not relative to the top level of the worktree.\n"},{"id":"191651","messageId":"1337333004-23164-1-git-send-email-jon.seymour@gmail.com","threadId":"30546","inReplyTo":"20120517182304.GA14367@burratino","subject":"[PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2012-05-18T09:23:24Z","receivedAt":"2012-05-18T09:23:24Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"The previous documentation was misleading because it lead the reader to believe\nthat --git-dir would always show a relative path when, in fact, the actual\nbehaviour does not guarantee this.\n\nRather, it was intended that the advice be given that if a relative path\nis shown, then the path is relative to the current working directory and not some\nother directory (for example, the root of the working tree).\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/git-rev-parse.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex f63b81a..4cc3e95 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -137,7 +137,8 @@ shown.  If the pattern does not contain a globbing character (`?`,\n \n --git-dir::\n \tShow `$GIT_DIR` if defined. Otherwise show the path to\n-\tthe .git directory, relative to the current directory.\n+\tthe .git directory. The path shown, when relative, is\n+\trelative to the current working directory.\n +\n If `$GIT_DIR` is not defined and the current directory\n is not detected to lie in a git repository or work tree\n-- \n1.7.10.1.514.ge33c7ea\n"},{"id":"191652","messageId":"20120518093159.GA31412@burratino","threadId":"30546","inReplyTo":"1337333004-23164-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-05-18T09:31:59Z","receivedAt":"2012-05-18T09:31:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jon Seymour wrote:\n\n> --- a/Documentation/git-rev-parse.txt\n> +++ b/Documentation/git-rev-parse.txt\n> @@ -137,7 +137,8 @@ shown.  If the pattern does not contain a globbing character (`?`,\n>  \n>  --git-dir::\n>  \tShow `$GIT_DIR` if defined. Otherwise show the path to\n> -\tthe .git directory, relative to the current directory.\n> +\tthe .git directory. The path shown, when relative, is\n> +\trelative to the current working directory.\n>  +\n>  If `$GIT_DIR` is not defined and the current directory\n>  is not detected to lie in a git repository or work tree\n\nThanks for taking care of it.\n\nI suppose I'd have used a subject line like the following for\nbrevity.\n\n\trev-parse doc: --git-dir does not always show a relative path\n\nFor what it's worth, with or without that change,\nAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"191653","messageId":"CACsJy8DNMcA_FKbKAYMvr19JqtsDy9a5nGBg8UoiAnOqunV2ow@mail.gmail.com","threadId":"30546","inReplyTo":"1337333004-23164-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-05-18T10:23:00Z","receivedAt":"2012-05-18T10:23:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, May 18, 2012 at 4:23 PM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> @@ -137,7 +137,8 @@ shown.  If the pattern does not contain a globbing character (`?`,\n>\n>  --git-dir::\n>        Show `$GIT_DIR` if defined. Otherwise show the path to\n> -       the .git directory, relative to the current directory.\n> +       the .git directory. The path shown, when relative, is\n> +       relative to the current working directory.\n>  +\n>  If `$GIT_DIR` is not defined and the current directory\n>  is not detected to lie in a git repository or work tree\n\nDefinitely an improvement. Thanks.\n-- \nDuy\n"},{"id":"191673","messageId":"xmqqsjex2syr.fsf@junio.mtv.corp.google.com","threadId":"30546","inReplyTo":"20120518093159.GA31412@burratino","subject":"Re: [PATCH v1] Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative paths","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-18T19:24:12Z","receivedAt":"2012-05-18T19:24:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both.\n"}]}