{"thread":{"id":"48606","subject":"git push requires a worktree?","startedAt":"2018-05-30T17:16:07Z","lastAt":"2018-05-30T18:51:26Z","messageCount":3,"participants":["David Turner","Stefan Beller","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"348821","messageId":"1527700562.4289.87.camel@novalis.org","threadId":"48606","inReplyTo":null,"subject":"git push requires a worktree?","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2018-05-30T17:16:02Z","receivedAt":"2018-05-30T17:16:07Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"I am doing a funny thing where I do git -C .git/modules/morx push\nfleem:fleem.  This is failing in the case where I have a sparse\ncheckout and the worktree directory \"morx\" (which is where\n.git/modules/morx/config's core.worktree points) doesn't exist.  \n\nI don't know why git push cares about the worktree -- it'll happily\nwork in a bare repo with no worktree at all, or if the worktree is an\nunrelated git repo or whatever.\n\nI can work around it, but if there's a bug, I think we should fix it.\n"},{"id":"348822","messageId":"CAGZ79kaT2KM0cZOSEXMpnr53TxUdH=gSbyQaGdBw1wEGnkK2Kw@mail.gmail.com","threadId":"48606","inReplyTo":"1527700562.4289.87.camel@novalis.org","subject":"Re: git push requires a worktree?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-05-30T17:32:35Z","receivedAt":"2018-05-30T17:32:40Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, May 30, 2018 at 10:16 AM, David Turner <novalis@novalis.org> wrote:\n> I am doing a funny thing where I do git -C .git/modules/morx push\n> fleem:fleem.\n\nI can do that, too. :)\n\n> This is failing in the case where I have a sparse\n> checkout and the worktree directory \"morx\" (which is where\n> .git/modules/morx/config's core.worktree points) doesn't exist.\n\nI could reproduce that without sparseness by removing that directory.\n\nBefore removing the dir in the worktree, the push worked fine; after\nremoving I got a\n\n    fatal: cannot chdir to '../../../entropy': No such file or directory\n\n> I don't know why git push cares about the worktree -- it'll happily\n> work in a bare repo with no worktree at all, or if the worktree is an\n> unrelated git repo or whatever.\n\nI think we should unset the worktree config for submodules that are\nnot checked out. I confirm that running\n  git config --unset -f .git/modules/<name>/config core.worktree\nwill have the push working as expected.\n\nSo I think it is not so much a bug in push, but there is\n* a bug in the submodule data design: Why do we need to store\n  core.worktree if there is no worktree? (I'll research if there are\n  historic artefacts that would suggest we need that)\n* the setup code for commands that do not have the\n  NEED_WORK_TREE flag in git.c\n\n> I can work around it, but if there's a bug, I think we should fix it.\n\nI think so, too.\n"},{"id":"348829","messageId":"CACsJy8Dy6Ft7jnj2SFz_0uLSxv9muujY_0nTvFbi3XGMEGFKgA@mail.gmail.com","threadId":"48606","inReplyTo":"CAGZ79kaT2KM0cZOSEXMpnr53TxUdH=gSbyQaGdBw1wEGnkK2Kw@mail.gmail.com","subject":"Re: git push requires a worktree?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-05-30T18:50:52Z","receivedAt":"2018-05-30T18:51:26Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, May 30, 2018 at 7:32 PM, Stefan Beller <sbeller@google.com> wrote:\n> * the setup code for commands that do not have the\n>   NEED_WORK_TREE flag in git.c\n\nUnless it's very urgent, I can fix it later (and hopefully soon-ish).\nThe problem is definitely not with setting core.worktree but with too\neagerly chdir() when you don't need it. We also have another problem\n(chdir'ing too late) in the same area that led to the introduction of\nchdir-notify. If I'm successful in killing chdir-notify by chdir at\nthe right time and with the right condition, then it should fix this\nas well. I'm pretty close to it, I think.\n-- \nDuy\n"}]}