-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
This is to handle the case where a plugin has a git submodule that changes its upstream URL.
In my case, I had to change a submodule-inside-of-a-submodule.
Let's assume I'm currently on any commit before chiphogg/vim-vtd@55771bc. If I do :PluginUpdate vim-vtd naively, I get
[2019-09-15 13:52:30]
[2019-09-15 13:52:30] Plugin chiphogg/vim-vtd
[2019-09-15 13:52:30] $ cd '/home/chogg/.vim/bundle/vim-vtd' && git pull && git submodule update --init --recursive
[2019-09-15 13:52:30] > Updating a4920a1..55771bc
[2019-09-15 13:52:30] > Fast-forward
[2019-09-15 13:52:30] > python/libvtd | 2 +-
[2019-09-15 13:52:30] > 1 file changed, 1 insertion(+), 1 deletion(-)
[2019-09-15 13:52:30] > Submodule path 'python/libvtd': checked out 'b93be3f1bacb2d9289042a4d090fb789de48ba5e'
[2019-09-15 13:52:30] > error: Server does not allow request for unadvertised object 03fa92bfedbe020724de5dde8864e3a9539162b4
[2019-09-15 13:52:30] > Fetched in submodule path 'python/libvtd/third_party/dateutil', but it did not contain 03fa92bfedbe020724de5dde8864e3a9539162b4. Direct fetching of that commit failed.
[2019-09-15 13:52:30] > Failed to recurse into submodule path 'python/libvtd'
[2019-09-15 13:52:30] >
[2019-09-15 13:52:31]
Ouch! Angry red exclamation mark; totally obscure and frustrating to most end users.
Then, I go to the repo root for vim-vtd, and run
git submodule sync --recursiveThis results in the following log for a successful :PluginUpdate vim-vtd:
[2019-09-15 13:53:17]
[2019-09-15 13:53:17] Plugin chiphogg/vim-vtd
[2019-09-15 13:53:17] $ cd '/home/chogg/.vim/bundle/vim-vtd' && git pull && git submodule update --init --recursive
[2019-09-15 13:53:17] > Already up to date.
[2019-09-15 13:53:17] > warning: no common commits
[2019-09-15 13:53:17] > From https://github.com/dateutil/dateutil
[2019-09-15 13:53:17] > + 2cfb879...4f22516 master -> origin/master (forced update)
[2019-09-15 13:53:17] > * [new tag] 2.1 -> 2.1
[2019-09-15 13:53:17] > * [new tag] 2.3 -> 2.3
[2019-09-15 13:53:17] > * [new tag] 2.4.0 -> 2.4.0
[2019-09-15 13:53:17] > * [new tag] 2.4.1 -> 2.4.1
[2019-09-15 13:53:17] > * [new tag] 2.4.2 -> 2.4.2
[2019-09-15 13:53:17] > * [new tag] 2.5.0 -> 2.5.0
[2019-09-15 13:53:17] > * [new tag] 2.5.1 -> 2.5.1
[2019-09-15 13:53:17] > * [new tag] 2.5.2 -> 2.5.2
[2019-09-15 13:53:17] > * [new tag] 2.6.0 -> 2.6.0
[2019-09-15 13:53:17] > * [new tag] 2.6.1 -> 2.6.1
[2019-09-15 13:53:17] > * [new tag] 2.7.0 -> 2.7.0
[2019-09-15 13:53:17] > * [new tag] 2.7.1 -> 2.7.1
[2019-09-15 13:53:17] > * [new tag] 2.7.2 -> 2.7.2
[2019-09-15 13:53:17] > * [new tag] 2.8.0 -> 2.8.0
[2019-09-15 13:53:17] > From https://github.com/dateutil/dateutil
[2019-09-15 13:53:17] > * branch 03fa92bfedbe020724de5dde8864e3a9539162b4 -> FETCH_HEAD
[2019-09-15 13:53:17] > Submodule path 'python/libvtd/third_party/dateutil': checked out '03fa92bfedbe020724de5dde8864e3a9539162b4'
[2019-09-15 13:53:17] >
[2019-09-15 13:53:17]
Success!
It seems to me there is a simple, clearly correct fix here: Vundle needs to run git submodule sync --recursive before it runs its submodule update command. This is necessary for plugins to continue to Just Work transparently for end users, when plugin authors switch their origin repo for submodules.
See also: https://stackoverflow.com/a/45679261