Browse Source

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.
pull/912/head
Chip Hogg 6 years ago
parent
commit
68aa67b224
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      autoload/vundle/installer.vim

+ 2
- 0
autoload/vundle/installer.vim View File

@ -392,6 +392,7 @@ func! s:make_sync_command(bang, bundle) abort
\ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri),
\ 'git fetch', \ 'git fetch',
\ 'git reset --hard origin/HEAD', \ 'git reset --hard origin/HEAD',
\ 'git submodule sync --recursive',
\ 'git submodule update --init --recursive', \ 'git submodule update --init --recursive',
\ ] \ ]
let cmd = join(cmd_parts, ' && ') let cmd = join(cmd_parts, ' && ')
@ -408,6 +409,7 @@ func! s:make_sync_command(bang, bundle) abort
let cmd_parts = [ let cmd_parts = [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()), \ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ 'git pull', \ 'git pull',
\ 'git submodule sync --recursive',
\ 'git submodule update --init --recursive', \ 'git submodule update --init --recursive',
\ ] \ ]
let cmd = join(cmd_parts, ' && ') let cmd = join(cmd_parts, ' && ')


Loading…
Cancel
Save