{"thread":{"id":"55234","subject":"Re: bug: setting GIT_DIR to $(git rev-parse --git-dir) changes behavior","startedAt":"2021-03-01T08:10:17Z","lastAt":"2021-03-01T08:10:17Z","messageCount":1,"participants":["Martin Nicolay"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"418007","messageId":"alpine.LSU.2.20.2103010847410.20742@cpza.bfz-tzou.qr","threadId":"55234","inReplyTo":null,"subject":"Re: bug: setting GIT_DIR to $(git rev-parse --git-dir) changes behavior","fromName":"Martin Nicolay","fromEmail":"m.nicolay@osm-ag.de","sentAt":"2021-03-01T08:08:31Z","receivedAt":"2021-03-01T08:10:17Z","isPatch":false,"sender":{"key":"m.nicolay@osm-ag.de","avatar":null},"body":"On Saturday 2021-02-27 22:06, Junio C Hamano wrote:\n> Martin Nicolay <m.nicolay@osm-ag.de> writes:\n>> *facepalm* The part about GIT_DIR setting the work-tree in addition to\n>>  the repository I hadn't read. How embarrasing.\n>>\n>> I apoligize for my bad reading skills and wasting you time.\n>\n> We would love to hear observations on which part of the\n> documentation was misleading and suggestions on how to make it\n> harder to misinterpret it.\n\nThere are multiple explanations regarding $DIR_DIR or --git-dir.\n\nFrom git(1) two parts:\n\n1)\n        --git-dir=<path>\n            Set the path to the repository (\".git\" directory). This can also be\n            controlled by setting the GIT_DIR environment variable. It can be\n            an absolute path or relative path to current working directory.\n\n            Specifying the location of the \".git\" directory using this option\n            (or GIT_DIR environment variable) turns off the repository\n            discovery that tries to find a directory with \".git\" subdirectory\n            (which is how the repository and the top-level of the working tree\n            are discovered), and tells Git that you are at the top level of the\n            working tree. If you are not at the top-level directory of the\n            working tree, you should tell Git where the top-level of the\n            working tree is, with the --work-tree=<path> option (or\n            GIT_WORK_TREE environment variable)\n\n2)\n        GIT_DIR\n            If the GIT_DIR environment variable is set then it specifies a path\n            to use instead of the default .git for the base of the repository.\n            The --git-dir command-line option also sets this value.\n\nThe first part mentions the dual effect of setting git-dir, the second \nnot so.\n\nAs I had used GIT_DIR described in the second part, I feel vindicated ;-)\nHooray, instead of a software-bug I've found a documentation-bug.\n\nMy suggestion is to ammend the first sentence to something like \"If the \nGIT_DIR environment variable is set then it specifies a path to use \ninstead of the default .git for the base of the repository and also the \ntop-level directory of the working tree.\"\n"}]}