From 4a3c5e7ac280b15d7279ef48e6a915cf49023cc6 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 27 Aug 2020 14:30:43 +0900 Subject: [PATCH] Support non-master default branch --- plug.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plug.vim b/plug.vim index 7914bfe..31c0786 100644 --- a/plug.vim +++ b/plug.vim @@ -106,7 +106,7 @@ if s:is_win && &shellslash else let s:me = resolve(expand(':p')) endif -let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:base_spec = { 'branch': '', 'frozen': 0 } let s:TYPE = { \ 'string': type(''), \ 'list': type([]), @@ -649,7 +649,7 @@ function! s:parse_options(arg) call extend(opts, a:arg) for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as'] if has_key(opts, opt) - \ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt])) + \ && (type(opts[opt]) != s:TYPE.string || (opt != 'branch' && empty(opts[opt]))) throw printf(opt_errfmt, opt, 'string') endif endfor @@ -1206,7 +1206,10 @@ function! s:update_finish() call s:log4(name, 'Checking out '.tag) let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir) else - let branch = get(spec, 'branch', 'master') + let branch = get(spec, 'branch', '') + if empty(branch) + let branch = s:git_get_branch(spec.dir) + endif call s:log4(name, 'Merging origin/'.s:esc(branch)) let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1' \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)