Skip to content

Commit

Permalink
Update submodules whenever the repo is updated
Browse files Browse the repository at this point in the history
It's not enough to track the changes in .gitmodules only
  • Loading branch information
junegunn committed Mar 24, 2016
1 parent db223a4 commit f666048
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,8 @@ function! s:regress_bar()
call s:progress_bar(2, bar, len(bar))
endfunction

function! s:is_updated(file, dir)
return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}" '.a:file, a:dir))
function! s:is_updated(dir)
return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir))
endfunction

function! s:do(pull, force, todo)
Expand All @@ -737,7 +737,7 @@ function! s:do(pull, force, todo)
endif
let installed = has_key(s:update.new, name)
let updated = installed ? 0 :
\ (a:pull && index(s:update.errors, name) < 0 && s:is_updated('', spec.dir))
\ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir))
if a:force || installed || updated
execute 'cd' s:esc(spec.dir)
call append(3, '- Post-update hook for '. name .' ... ')
Expand Down Expand Up @@ -958,7 +958,7 @@ function! s:update_finish()
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir)
endif
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
\ (has_key(s:update.new, name) || s:is_updated('.gitmodules', spec.dir))
\ (has_key(s:update.new, name) || s:is_updated(spec.dir))
call s:log4(name, 'Updating submodules. This may take a while.')
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
endif
Expand Down

0 comments on commit f666048

Please sign in to comment.