{"thread":{"id":"30006","subject":"Annoying absolute path for \"core.worktree\" to submodule","startedAt":"2012-03-20T09:52:43Z","lastAt":"2012-03-21T19:41:43Z","messageCount":5,"participants":["Christian Hammerl","Antony Male","Holding, Lawrence","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"187311","messageId":"20120320105243.2e8a489b@christian-hammerl.de","threadId":"30006","inReplyTo":null,"subject":"Annoying absolute path for \"core.worktree\" to submodule","fromName":"Christian Hammerl","fromEmail":"info@christian-hammerl.de","sentAt":"2012-03-20T09:52:43Z","receivedAt":"2012-03-20T09:52:43Z","isPatch":false,"sender":{"key":"info@christian-hammerl.de","avatar":"https://avatars.githubusercontent.com/u/838666?v=4"},"body":"Hey folks,\n\nI really love the work you are doing on GIT but the last update\nregarding submodules is a bit annoying. Although the path inside the\n\".git\" file is stored relative to the submodule's path, the path in\n\".git/modules/path-to-submodule/config\" is stored as an absolute path\nfor \"core.worktree\".\n\nI develop (for some projects) within a chroot where I have a different\nusername and therefore the path differs if I am currently inside the\nchroot or not. If the submodule is initialized inside the chroot, I\nalways get this message when I cd into the project's directory outside\nof the chroot:\n\nfatal: Could not switch to\n'/home/chroot-username/parent-path-of-submodule': File or directory not\nfound\nfatal: 'git status --porcelain' failed in submodule\nrelative-path-to-submodule\n\nThis is caused by using `__git_ps1` for my bash-prompt. I don't know\nexactly where the problem is and what actions (called by __git_ps1) are\nresponsible for this.\n\nAny suggestions how to deal with this?\n\nAnd no, removing __git_ps1 from my bash-prompt is not the answer, I\nlike this feature very much. ;-)\n\nThanks in advance\nChristian\n"},{"id":"187329","messageId":"4F6886A6.3010805@gmail.com","threadId":"30006","inReplyTo":"20120320105243.2e8a489b@christian-hammerl.de","subject":"Re: Annoying absolute path for \"core.worktree\" to submodule","fromName":"Antony Male","fromEmail":"antony.male@gmail.com","sentAt":"2012-03-20T13:31:18Z","receivedAt":"2012-03-20T13:31:18Z","isPatch":false,"sender":{"key":"antony.male@gmail.com","avatar":"https://gravatar.com/avatar/44ebc98c2d05837be689ed72514f8119844424a9cf099e5202be4190281982f1?d=mp&s=160"},"body":"On 20/03/2012 9:52 am, Christian Hammerl wrote:\n> Hey folks,\n>\n> I really love the work you are doing on GIT but the last update\n> regarding submodules is a bit annoying. Although the path inside the\n> \".git\" file is stored relative to the submodule's path, the path in\n> \".git/modules/path-to-submodule/config\" is stored as an absolute path\n> for \"core.worktree\".\n\nWhat are you referring to as the \"last update\"? v1.7.8 introduced the \nseparate git dir for submodules, and used an absolute path.\n\nThis absolute path was changed to a relative path in the patchset at \n[1], which is present in v1.7.10-rc1.\n\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/192173\n"},{"id":"187361","messageId":"A5E8E180685CEF45AB9E737A010799802D9872@cdnz-ex1.corp.cubic.cub","threadId":"30006","inReplyTo":"4F6886A6.3010805@gmail.com","subject":"RE: Annoying absolute path for \"core.worktree\" to submodule","fromName":"Holding, Lawrence","fromEmail":"lawrence.holding@cubic.com","sentAt":"2012-03-20T21:39:56Z","receivedAt":"2012-03-20T21:39:56Z","isPatch":false,"sender":{"key":"lawrence.holding@cubic.com","avatar":null},"body":"> Antony Male wrote:\n> On 20/03/2012 9:52 am, Christian Hammerl wrote:\n> > Hey folks,\n> >\n> > I really love the work you are doing on GIT but the last update\n> > regarding submodules is a bit annoying. Although the path inside the\n> > \".git\" file is stored relative to the submodule's path, the path in\n> > \".git/modules/path-to-submodule/config\" is stored as an absolute\npath\n> > for \"core.worktree\".\n> \n> What are you referring to as the \"last update\"? v1.7.8 introduced the\n> separate git dir for submodules, and used an absolute path.\n> \n> This absolute path was changed to a relative path in the patchset at\n> [1], which is present in v1.7.10-rc1.\n> \n> [1]: http://thread.gmane.org/gmane.comp.version-control.git/192173\n\nSlightly off topic, but related, what is the recommended way for finding\nthe git folder from the top level project or any of the submodules? And\nof finding the working tree from inside a hook script?\n\nContext: One of the (optional) steps in our build process installs\npre-commit hooks into the git/hooks folder of the tools submodule and\ninto the git/hooks folder of the next level up project. Then on commit\nthe hook reads the config file from inside the tools submodule and\nchecks file formats and naming standards before permitting the commit.\nThe current implementation has the paths hard coded between the two\nlocation, now with some having the old layout and some the new, we are\nlooking for a consistent solution without duplicating the logic in the\ngit executables.\n"},{"id":"187379","messageId":"20120321104203.44dd0f95@christian-hammerl.de","threadId":"30006","inReplyTo":"4F6886A6.3010805@gmail.com","subject":"Re: Re: Annoying absolute path for \"core.worktree\" to submodule","fromName":"Christian Hammerl","fromEmail":"info@christian-hammerl.de","sentAt":"2012-03-21T09:42:03Z","receivedAt":"2012-03-21T09:42:03Z","isPatch":false,"sender":{"key":"info@christian-hammerl.de","avatar":"https://avatars.githubusercontent.com/u/838666?v=4"},"body":"> What are you referring to as the \"last update\"? v1.7.8 introduced the \n> separate git dir for submodules, and used an absolute path.\n\nAh ok, my current Version is 1.7.9.4. I did not recognize this\nbehaviour before, so I assumed it came with the last update. Sorry for\nthat.\n\n> This absolute path was changed to a relative path in the patchset at \n> [1], which is present in v1.7.10-rc1.\n> \n> \n> [1]: http://thread.gmane.org/gmane.comp.version-control.git/192173\n\nI see, thanks for the information.\nI think I will wait until my linux distribution will update the\npackage to 1.7.10. For now it works for me to replace the .git file\nwith the corresponding repository which is located at \".git/modules/*\"\nwithin the superproject.\n"},{"id":"187424","messageId":"4F6A2EF7.5090007@web.de","threadId":"30006","inReplyTo":"A5E8E180685CEF45AB9E737A010799802D9872@cdnz-ex1.corp.cubic.cub","subject":"Re: Annoying absolute path for \"core.worktree\" to submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-03-21T19:41:43Z","receivedAt":"2012-03-21T19:41:43Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 20.03.2012 22:39, schrieb Holding, Lawrence:\n> Slightly off topic, but related, what is the recommended way for finding\n> the git folder from the top level project or any of the submodules?\n\nRun \"git rev-parse --git-dir\" inside the repo whose git folder you want to\nknow.\n\n> And of finding the working tree from inside a hook script?\n\nI would expect hooks to be run in the work tree's top level directory,\nbut I haven't checked that.\n"}]}