From fb8a5f92465f3925503e42e67b70a42dddbc936b Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 22 Oct 2015 13:23:35 +0900 Subject: [PATCH] Post-update hook should not run in case of an error --- plug.vim | 2 +- test/workflow.vader | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index edf9552..b63d777 100644 --- a/plug.vim +++ b/plug.vim @@ -646,7 +646,7 @@ function! s:do(pull, force, todo) endif let installed = has_key(s:update.new, name) let updated = installed ? 0 : - \ (a:pull && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) + \ (a:pull && index(s:update.errors, name) < 0 && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) if a:force || installed || updated execute 'cd' s:esc(spec.dir) call append(3, '- Post-update hook for '. name .' ... ') diff --git a/test/workflow.vader b/test/workflow.vader index e8db40f..fa47238 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -756,6 +756,28 @@ Execute (Using Funcref): Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'), \ 'vim-pseudocl/vim-pseudoclunchanged13 should exist' +Execute (Should not run when failed to update): + call plug#begin() + Plug 'junegunn/vim-easy-align', { 'do': 'touch failed' } + Plug 'junegunn/vim-pseudocl', { 'do': 'touch not-failed' } + call plug#end() + + " Invalid remote URL + call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir)) + + " New commits on remote + call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"') + call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"') + + silent PlugUpdate + Log getline(1, '$') + q + + Assert !filereadable(g:plugs['vim-easy-align'].dir.'/failed'), + \ 'vim-easy-align/failed should not exist' + Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'), + \ 'vim-pseudocl/not-failed should exist' + ********************************************************************** ~ Overriding `dir` **********************************************************************