{"thread":{"id":"48295","subject":".gitattributes lookup doesn't respect GIT_WORK_TREE","startedAt":"2018-04-15T19:04:45Z","lastAt":"2018-04-16T15:38:35Z","messageCount":4,"participants":["Andreas Schwab","Junio C Hamano","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"344747","messageId":"877ep8p9yz.fsf@linux-m68k.org","threadId":"48295","inReplyTo":null,"subject":".gitattributes lookup doesn't respect GIT_WORK_TREE","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2018-04-15T19:04:36Z","receivedAt":"2018-04-15T19:04:45Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"The functions in attr.c do not look at $GIT_WORK_TREE when trying to\nfind the .gitattributes file.  Thus if you are not inside the work tree,\nbut have GIT_WORK_TREE set attribute lookup will be wrong.\n\nPassword Store <http://www.passwordstore.org/> is using this feature\nwhen the password store is a git repository.  It sets up a diff\nattribute that decrypts the contents, but that works only if the command\nis issued while inside the repository.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"344754","messageId":"xmqqin8s18pg.fsf@gitster-ct.c.googlers.com","threadId":"48295","inReplyTo":"877ep8p9yz.fsf@linux-m68k.org","subject":"Re: .gitattributes lookup doesn't respect GIT_WORK_TREE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-04-15T21:05:47Z","receivedAt":"2018-04-15T21:05:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> The functions in attr.c do not look at $GIT_WORK_TREE when trying to\n> find the .gitattributes file.  Thus if you are not inside the work tree,\n> but have GIT_WORK_TREE set attribute lookup will be wrong.\n\nI may be mistaken (I do not have the code in front of me right now)\nbut IIRC after the setup.c code runs (which happens quite early in\nthe sequence that starts from git.c::cmd_main()), the Git process\nmoves to the top level of the working tree, and at that point there\nis no reason to pay attention to $GIT_WORK_TREE or other mechanisms\nthat places the working tree at a non-standard location, because the\nattributes (or any in-tree files like .gitignore or .gitmodules)\nwill be found relative to the current working directory no matter\nwhat.  Did we break that recently?\n\n"},{"id":"344761","messageId":"8736zwozze.fsf@linux-m68k.org","threadId":"48295","inReplyTo":"xmqqin8s18pg.fsf@gitster-ct.c.googlers.com","subject":"Re: .gitattributes lookup doesn't respect GIT_WORK_TREE","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2018-04-15T22:40:21Z","receivedAt":"2018-04-15T22:40:31Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Apr 16 2018, Junio C Hamano <gitster@pobox.com> wrote:\n\n> I may be mistaken (I do not have the code in front of me right now)\n> but IIRC after the setup.c code runs (which happens quite early in\n> the sequence that starts from git.c::cmd_main()), the Git process\n> moves to the top level of the working tree,\n\ngit log/show don't appear to do that.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"344795","messageId":"CACsJy8DofC0Q9HPE69d=Cd930yG04wTiJdx2j5J8qgSEstr-Pg@mail.gmail.com","threadId":"48295","inReplyTo":"8736zwozze.fsf@linux-m68k.org","subject":"Re: .gitattributes lookup doesn't respect GIT_WORK_TREE","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-04-16T15:37:59Z","receivedAt":"2018-04-16T15:38:35Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Apr 16, 2018 at 12:40 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> On Apr 16 2018, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> I may be mistaken (I do not have the code in front of me right now)\n>> but IIRC after the setup.c code runs (which happens quite early in\n>> the sequence that starts from git.c::cmd_main()), the Git process\n>> moves to the top level of the working tree,\n>\n> git log/show don't appear to do that.\n\nYeah we lazily set up worktree in some cases. Elsewhere in the\nchdir-notify thread, I suggested that we set up worktree\nunconditionally (but do not die setup fails; only die when a command\nspecifically requests for worktree). That work would help make this\nwork in most cases. But it's not materialized yet.\n-- \nDuy\n"}]}