Hi, comments see inline.
KR, Mike.
On 20.09.24 12:24, Dennis Lubert wrote:
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
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