Skip to content

Commit 6365e01

Browse files
chiphogg5HT2
authored andcommitted
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 VundleVim#911.
1 parent 3f2c3fe commit 6365e01

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

autoload/vundle/installer.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ func! s:make_sync_command(bang, bundle) abort
392392
\ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri),
393393
\ 'git fetch',
394394
\ 'git reset --hard origin/HEAD',
395+
\ 'git submodule sync --recursive',
395396
\ 'git submodule update --init --recursive',
396397
\ ]
397398
let cmd = join(cmd_parts, ' && ')
@@ -408,6 +409,7 @@ func! s:make_sync_command(bang, bundle) abort
408409
let cmd_parts = [
409410
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
410411
\ 'git pull',
412+
\ 'git submodule sync --recursive',
411413
\ 'git submodule update --init --recursive',
412414
\ ]
413415
let cmd = join(cmd_parts, ' && ')

0 commit comments

Comments
 (0)