Re: Unable to checkout branch that has a new submodule with submodule.recurse
- From
- Mike Fink <mike.fink@gmx.de>
- Date
- Oct 31, 2024, 08:30 UTC
- Message-ID
- <17601d47-5d44-4516-b4a0-052a0023d537@gmx.de>
- In-Reply-To
- <0218f6c7486cb6747a61db4a9d4990eab11f313f.camel@gmx.net>
Hi, comments see inline. KR, Mike.
On 20.09.24 12:24, Dennis Lubert wrote:
Show 13 quoted lines
> Hello World, > > for years now this has been bothering me. From time to time there is a > new submodule in a branch and when checking that one out with my > standard setup I get something like: > >> git checkout branchname > > fatal: not a git repository: ../.git/modules/submodule_new > fatal: could not reset submodule index > > (this happens on all versions up to 2.46.1 and OS and whatnot I have > access to)
I do experience the same problem with the current git for windows version. $ git --version git version 2.47.0.windows.2
Show 22 quoted lines
> > While the workaround is clear (either clone with the desired branch > right away or dont use --recurse-submodules and do update --init > yourself), this is quite unfortunate for people in teams that work > mostly with git integration or gui, also because when this happens it > leaves the repo in an annoying state that needs a bit more manual > cleanup than --reset hard sometimes and especially for people that just > use the basics this can be overwhelming. > > It seems that there is something wrong going on with the order of > creation of the .git file and .git/modules/submodule/config entries, > but I am not deep enough in the details to comment more on that. > > To help reproduce the problem reliably (hopefully) I have attached a > shell script. You can run it in an empty directory (please review it > before you do, I hacked it together, it might delete the wrong thing > accidentally). It will need local ssh access (though I think modifying > it to use local repos as submodules could be the same). > > greets > > Dennis