Shougo / dein.vim

:zap: Dark powered Vim/Neovim plugin manager
MIT License
3.41k stars 197 forks source link

Unite source `dein:!` is broken #436

Closed pi-rho closed 2 years ago

pi-rho commented 2 years ago

Warning: I will close the bug issue without the minimal init.vim and the reproduce ways.

Problems summary

Unite source dein:! is broken

Expected

That it is not broken

Environment Information (Required!)

Provide a minimal .vimrc with less than 50 lines (Required!)

" Your minimal .vimrc
set runtimepath^=~/path/to/dein.nvim/
call dein#begin(path)
call dein#add('Shougo/unite.vim')
call dein#end()

The reproduce ways from Vim starting (Required!)

  1. :Unite dein:!
  2. ERROR!!

Screen shot (if possible)

n/a

Upload the log messages by :redir and :message (if errored)

[unite.vim] function unite#helper#call_unite[33]..unite#start[1]..unite#start#standard[50]..unite#candidates#_recache[74]..<SNR>170_recache_candidates
_loop[42]..<SNR>170_get_source_candidates[40]..30[28]..<SNR>166_get_commit_status, line 6
[unite.vim] Vim(let):E716: Key not present in Dictionary: "get_revision_number_command(a:plugin)"
[unite.vim] Error occurred in gather_candidates!
[unite.vim] Source name is dein

Attached patch describes one way to solve the issue. Another way would be to use git to describe the revision instead of mucking around in git internals (i.e., git describe --always --dirty --broken --abbrev=5).

diff --git i/autoload/dein/install.vim w/autoload/dein/install.vim
index 00ddd4a..194908f 100644
--- i/autoload/dein/install.vim
+++ w/autoload/dein/install.vim
@@ -686,6 +686,9 @@ function! s:get_sync_command(plugin, update_type, number, max) abort "{{{i

   return [cmd, message]
 endfunction
+function! dein#install#_get_revision_number(plugin)
+   return s:get_revision_number(a:plugin)
+endfunction
 function! s:get_revision_number(plugin) abort
   if !isdirectory(a:plugin.path)
     return ''
diff --git i/autoload/unite/sources/dein.vim w/autoload/unite/sources/dein.vim
index ba4ffeb..51b33d3 100644
--- i/autoload/unite/sources/dein.vim
+++ w/autoload/unite/sources/dein.vim
@@ -81,28 +81,5 @@ function! s:source.gather_candidates(args, context) abort
 endfunction

 function! s:get_commit_status(plugin) abort
-  if !isdirectory(a:plugin.path)
-    return 'Not installed'
-  endif
-
-  let type = dein#types#git#define()
-  let cmd = type.get_revision_number_command(a:plugin)
-  if cmd ==# ''
-    return ''
-  endif
-
-  let cwd = getcwd()
-  try
-    call dein#install#_cd(a:plugin.path)
-    let output = dein#install#_system(cmd)
-  finally
-    call dein#install#_cd(cwd)
-  endtry
-
-  if dein#install#_get_last_status()
-    return printf('Error(%d) occurred when executing "%s"',
-          \ dein#install#_get_last_status(), cmd)
-  endif
-
-  return output
+  return dein#install#_get_revision_number(a:plugin)
 endfunction
Shougo commented 2 years ago

Another way would be to use git to describe the revision instead of mucking around in git internals (i.e., git describe --always --dirty --broken --abbrev=5).

The solution is slow.