Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating plugins should first call git submodule sync #911

Open
chiphogg opened this issue Sep 15, 2019 · 0 comments · Fixed by 5HT2C/Vundle.vim#1 · May be fixed by #912
Open

Updating plugins should first call git submodule sync #911

chiphogg opened this issue Sep 15, 2019 · 0 comments · Fixed by 5HT2C/Vundle.vim#1 · May be fixed by #912

Comments

@chiphogg
Copy link
Contributor

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 --recursive

This 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

chiphogg pushed a commit to chiphogg/Vundle.vim that referenced this issue Sep 15, 2019
This ensures the origin in `.git/config` matches the one in
`.gitmodules`.  Git will quite appropriately refrain from doing this
automatically, because it never allows remote repositories to update
local config.  You have to ask.

(See: https://stackoverflow.com/a/45679261)

In Vundle's case, it is always correct to sync.  These aren't repos that
a developer maintains; they are effectively read-only copies of remote
state.  Since syncing is always correct, and git won't sync unless we
ask, then we should always sync.

Fixes VundleVim#911.
chiphogg added a commit to chiphogg/Vundle.vim that referenced this issue Sep 15, 2019
This ensures the origin in `.git/config` matches the one in
`.gitmodules`.  Git will quite appropriately refrain from doing this
automatically, because it never allows remote repositories to update
local config.  You have to ask.

(See: https://stackoverflow.com/a/45679261)

In Vundle's case, it is always correct to sync.  These aren't repos that
a developer maintains; they are effectively read-only copies of remote
state.  Since syncing is always correct, and git won't sync unless we
ask, then we should always sync.

Fixes VundleVim#911.
@chiphogg chiphogg linked a pull request Sep 15, 2019 that will close this issue
detwiler pushed a commit to detwiler/Vundle.vim that referenced this issue Dec 21, 2020
This ensures the origin in `.git/config` matches the one in
`.gitmodules`.  Git will quite appropriately refrain from doing this
automatically, because it never allows remote repositories to update
local config.  You have to ask.

(See: https://stackoverflow.com/a/45679261)

In Vundle's case, it is always correct to sync.  These aren't repos that
a developer maintains; they are effectively read-only copies of remote
state.  Since syncing is always correct, and git won't sync unless we
ask, then we should always sync.

Fixes VundleVim#911.
detwiler added a commit to detwiler/Vundle.vim that referenced this issue Dec 21, 2020
This ensures the origin in `.git/config` matches the one in
`.gitmodules`.  Git will quite appropriately refrain from doing this
automatically, because it never allows remote repositories to update
local config.  You have to ask.

(See: https://stackoverflow.com/a/45679261)

In Vundle's case, it is always correct to sync.  These aren't repos that
a developer maintains; they are effectively read-only copies of remote
state.  Since syncing is always correct, and git won't sync unless we
ask, then we should always sync.

Fixes VundleVim#911.

Co-authored-by: Chip Hogg <[email protected]>
5HT2 pushed a commit to 5HT2C/Vundle.vim that referenced this issue Sep 3, 2024
This ensures the origin in `.git/config` matches the one in
`.gitmodules`.  Git will quite appropriately refrain from doing this
automatically, because it never allows remote repositories to update
local config.  You have to ask.

(See: https://stackoverflow.com/a/45679261)

In Vundle's case, it is always correct to sync.  These aren't repos that
a developer maintains; they are effectively read-only copies of remote
state.  Since syncing is always correct, and git won't sync unless we
ask, then we should always sync.

Fixes VundleVim#911.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant