Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does recursive submodule update from github fail for DoctrineMongoORMModule?

Is this something I am doing wrong, or a wider bug?

If I execute the following git commands in an empty directory:

git init
git submodule add https://github.com/doctrine/DoctrineMongoODMModule \vendor\DoctrineMongoODMModule
git submodule update --init --recursive

The all goes well, multiple submodules are pulled, and then it fails with the following output:

fatal: not a git repository: ../../../../../../../../../../.git/modules/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doctrine-mongodb/modules/lib/vendor/doctrine-common
Unable to find current revision in submodule pat 'lib/vendor/doctrine-common'

I've done a bit more digging. The .git file in the submodule that is causing the problem has the following contents:

gitdir: ../../../../../../../../../../.git/modules/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doctrine-mongodb/modules/lib/vendor/doctrine-common

I have checked that gitdir path, and it does exist. However, I am using a Windows XP machine and if I attempt this from the cmd prompt I have problems:

C:\xds\sds\vendor\DoctrineMongoODMModule\vendor\mongodb-odm\lib\vendor\doctrine-
mongodb\lib\vendor\doctrine-common>cd ../../../../../../../../../../.git/modules
/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doc
trine-mongodb/modules/lib/vendor/doctrine-common
The system cannot find the path specified.

It appears that the directory change string is too long, because if I split it into two parts it works:

C:\xds\sds\vendor\DoctrineMongoODMModule\vendor\mongodb-odm\lib\vendor\doctrine-
mongodb\lib\vendor\doctrine-common>cd ../../../../../../../../../../.git/modules
/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doc
trine-mongodb/

C:\xds\sds\.git\modules\vendor\DoctrineMongoODMModule\modules\vendor\mongodb-odm
\modules\lib\vendor\doctrine-mongodb>cd modules/lib/vendor/doctrine-common

C:\xds\sds\.git\modules\vendor\DoctrineMongoODMModule\modules\vendor\mongodb-odm
\modules\lib\vendor\doctrine-mongodb\modules\lib\vendor\doctrine-common>

Any advice or help would be appreciated. Cheers.

like image 767
superdweebie Avatar asked Mar 25 '26 08:03

superdweebie


1 Answers

Ok, so I worked out the problem. Mingw32 has a path length limit, which is related to the windows path length limit (see msdn). Problem was overcome by shortening the gitdir path. Rather than using a relative path, I've changed it to an absolute path, witch elimaties ../../../../../../../../../../ from the gitdir string in exchange for c:/xds/sds. That shortening is just enought to make it all go.

like image 98
superdweebie Avatar answered Mar 27 '26 22:03

superdweebie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!