{"thread":{"id":"62152","subject":"Unable to checkout branch that has a new submodule with submodule.recurse","startedAt":"2024-09-20T10:24:34Z","lastAt":"2024-10-31T08:30:13Z","messageCount":2,"participants":["Dennis Lubert","Mike Fink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"503120","messageId":"0218f6c7486cb6747a61db4a9d4990eab11f313f.camel@gmx.net","threadId":"62152","inReplyTo":null,"subject":"Unable to checkout branch that has a new submodule with submodule.recurse","fromName":"Dennis Lubert","fromEmail":"plasmahh@gmx.net","sentAt":"2024-09-20T10:24:33Z","receivedAt":"2024-09-20T10:24:34Z","isPatch":false,"sender":{"key":"plasmahh@gmx.net","avatar":null},"body":"Hello World,\n\nfor years now this has been bothering me. From time to time there is a\nnew submodule in a branch and when checking that one out with my\nstandard setup I get something like:\n\n> git checkout branchname\n\nfatal: not a git repository: ../.git/modules/submodule_new\nfatal: could not reset submodule index\n\n(this happens on all versions up to 2.46.1 and OS and whatnot I have\naccess to)\n\nWhile the workaround is clear (either clone with the desired branch\nright away or dont use --recurse-submodules and do update --init\nyourself), this is quite unfortunate for people in teams that work\nmostly with git integration or gui, also because when this happens it\nleaves the repo in an annoying state that needs  a bit more manual\ncleanup than --reset hard sometimes and especially for people that just\nuse the basics this can be overwhelming.\n\nIt seems that there is something wrong going on with the order of\ncreation of the .git file and .git/modules/submodule/config entries,\nbut I am not deep enough in the details to comment more on that.\n\nTo help reproduce the problem reliably (hopefully) I have attached a\nshell script. You can run it in an empty directory (please review it\nbefore you do, I hacked it together, it might delete the wrong thing\naccidentally). It will need local ssh access (though I think modifying\nit to use local repos as submodules could be the same).\n\ngreets\n\nDennis\n"},{"id":"506365","messageId":"17601d47-5d44-4516-b4a0-052a0023d537@gmx.de","threadId":"62152","inReplyTo":"0218f6c7486cb6747a61db4a9d4990eab11f313f.camel@gmx.net","subject":"Re: Unable to checkout branch that has a new submodule with submodule.recurse","fromName":"Mike Fink","fromEmail":"mike.fink@gmx.de","sentAt":"2024-10-31T08:30:11Z","receivedAt":"2024-10-31T08:30:13Z","isPatch":false,"sender":{"key":"mike.fink@gmx.de","avatar":null},"body":"Hi, comments see inline.\nKR, Mike.\n\nOn 20.09.24 12:24, Dennis Lubert wrote:\n> Hello World,\n>\n> for years now this has been bothering me. From time to time there is a\n> new submodule in a branch and when checking that one out with my\n> standard setup I get something like:\n>\n>> git checkout branchname\n>\n> fatal: not a git repository: ../.git/modules/submodule_new\n> fatal: could not reset submodule index\n>\n> (this happens on all versions up to 2.46.1 and OS and whatnot I have\n> access to)\n\nI do experience the same problem with the current git for windows version.\n$ git --version\ngit version 2.47.0.windows.2\n\n>\n> While the workaround is clear (either clone with the desired branch\n> right away or dont use --recurse-submodules and do update --init\n> yourself), this is quite unfortunate for people in teams that work\n> mostly with git integration or gui, also because when this happens it\n> leaves the repo in an annoying state that needs  a bit more manual\n> cleanup than --reset hard sometimes and especially for people that just\n> use the basics this can be overwhelming.\n>\n> It seems that there is something wrong going on with the order of\n> creation of the .git file and .git/modules/submodule/config entries,\n> but I am not deep enough in the details to comment more on that.\n>\n> To help reproduce the problem reliably (hopefully) I have attached a\n> shell script. You can run it in an empty directory (please review it\n> before you do, I hacked it together, it might delete the wrong thing\n> accidentally). It will need local ssh access (though I think modifying\n> it to use local repos as submodules could be the same).\n>\n> greets\n>\n> Dennis\n\n"}]}