mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +08:00
Fix PlugStatus reporting divergence when a tag is specified (#1321)
Some checks failed
Test vim-plug / build (vim) (push) Has been cancelled
Some checks failed
Test vim-plug / build (vim) (push) Has been cancelled
This commit is contained in:
20
plug.vim
20
plug.vim
@@ -2383,7 +2383,9 @@ function! s:git_validate(spec, check_branch)
|
|||||||
let err = join(['Invalid URI: '.remote,
|
let err = join(['Invalid URI: '.remote,
|
||||||
\ 'Expected: '.a:spec.uri,
|
\ 'Expected: '.a:spec.uri,
|
||||||
\ 'PlugClean required.'], "\n")
|
\ 'PlugClean required.'], "\n")
|
||||||
elseif a:check_branch && has_key(a:spec, 'commit')
|
elseif !a:check_branch
|
||||||
|
return ['', 0]
|
||||||
|
elseif has_key(a:spec, 'commit')
|
||||||
let sha = s:git_revision(a:spec.dir)
|
let sha = s:git_revision(a:spec.dir)
|
||||||
if empty(sha)
|
if empty(sha)
|
||||||
let err = join(add(result, 'PlugClean required.'), "\n")
|
let err = join(add(result, 'PlugClean required.'), "\n")
|
||||||
@@ -2392,18 +2394,16 @@ function! s:git_validate(spec, check_branch)
|
|||||||
\ a:spec.commit[:6], sha[:6]),
|
\ a:spec.commit[:6], sha[:6]),
|
||||||
\ 'PlugUpdate required.'], "\n")
|
\ 'PlugUpdate required.'], "\n")
|
||||||
endif
|
endif
|
||||||
|
elseif has_key(a:spec, 'tag')
|
||||||
|
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
||||||
|
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
|
||||||
|
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
||||||
|
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
||||||
|
endif
|
||||||
elseif a:check_branch
|
elseif a:check_branch
|
||||||
let current_branch = result[0]
|
let current_branch = result[0]
|
||||||
" Check tag
|
|
||||||
let origin_branch = s:git_origin_branch(a:spec)
|
let origin_branch = s:git_origin_branch(a:spec)
|
||||||
if has_key(a:spec, 'tag')
|
if origin_branch !=# current_branch
|
||||||
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
|
||||||
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
|
|
||||||
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
|
||||||
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
|
||||||
endif
|
|
||||||
" Check branch
|
|
||||||
elseif origin_branch !=# current_branch
|
|
||||||
let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
|
let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
|
||||||
\ current_branch, origin_branch)
|
\ current_branch, origin_branch)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user