From 68aa67b224dad47d307d5e222bbed80e184798b7 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Sun, 15 Sep 2019 16:02:40 -0400 Subject: [PATCH] Always sync submodules before updating them 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 #911. --- autoload/vundle/installer.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 472271a3..d5b77acb 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -392,6 +392,7 @@ func! s:make_sync_command(bang, bundle) abort \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), \ 'git fetch', \ 'git reset --hard origin/HEAD', + \ 'git submodule sync --recursive', \ 'git submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') @@ -408,6 +409,7 @@ func! s:make_sync_command(bang, bundle) abort let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()), \ 'git pull', + \ 'git submodule sync --recursive', \ 'git submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ')