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 authored and detwiler committed Dec 21, 2020
1 parent d45bdb4 commit dd32641
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 @@ -394,6 +394,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 @@ -410,6 +411,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 dd32641

Please sign in to comment.