Skip to content

Commit

Permalink
Always sync submodules before updating them
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chiphogg committed Sep 15, 2019
1 parent b255382 commit 68aa67b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions autoload/vundle/installer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' && ')
Expand All @@ -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, ' && ')
Expand Down

0 comments on commit 68aa67b

Please sign in to comment.