Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error for plugins with the 'rev' indicator #310

Closed
rafi opened this issue Sep 9, 2014 · 7 comments
Closed

Update error for plugins with the 'rev' indicator #310

rafi opened this issue Sep 9, 2014 · 7 comments

Comments

@rafi
Copy link

rafi commented Sep 9, 2014

Problem

Plugins with the rev indicator get an error on update:

You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details.^@^@ git pull

The reason is that plugins with rev are being checked-out as "detached" branches which are read-only, git-pull is not permitted on a detached branch.

Expect

I would expect to see no errors when updating my plugins.

Reproduce

Minimal .vimrc:

if has('vim_starting')
  set nocompatible
  set runtimepath+=~/.vim/bundle/neobundle.vim/
endif

call neobundle#begin(expand('~/.vim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'pangloss/vim-javascript.git', { 'rev': '51a337b' }
NeoBundle 'groenewege/vim-less.git', { 'rev': '5d965c2' }
call neobundle#end()

filetype plugin indent on
NeoBundleCheck
  1. Open vim and let NeoBundle install plugins.
  2. Run :NeoBundleUpdate! (force) to update plugins.
  3. Run :message.

Notice the errors for plugins with the rev indicator.

Ideas

I can think of some solutions:

Option A: Use real branch

When a plugin has a rev, do not detach, checkout with a real branch e.g. git checkout -b rev 63f0392

Option B: Check current revision

Before pulling, if (a) plugin has rev AND (b) already cloned, verify current revision and cancel pulling if current revision == rev indicator.

Option C: Checkout master

Before pulling, if (a) plugin has rev, AND (b) already cloned, checkout the local branch master. (git checkout master)

Hope this helps..

@Shougo
Copy link
Owner

Shougo commented Sep 9, 2014

Option A: Use real branch

No. I tested it. But it will print errors.

Option B: Check current revision

I think it is better...

@rafi
Copy link
Author

rafi commented Sep 10, 2014

Agree, option B would be the quickest and cleanest fix without over-complicating things now.
Does anyone else have any thoughts on this? Calling out for opinions..

@Shougo Shougo closed this as completed in 34bb023 Sep 10, 2014
@Shougo
Copy link
Owner

Shougo commented Sep 10, 2014

Fixed the problem by C.

@petobens
Copy link

petobens commented Mar 9, 2015

Mmm I'm having a similar problem. With the following minimal vimrc:

set nocompatible

let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')
set runtimepath+=$DOTVIM/bundle/neobundle/

call neobundle#begin(expand('$DOTVIM/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim', {'name' : 'neobundle'}
NeoBundle 'bling/vim-airline', {'name' : 'airline'}
call neobundle#end()

filetype plugin indent on
NeoBundleCheck

set laststatus=2
set noshowmode

If I run NeoBundleUpdate airline I get an error saying:

You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

If i install airline like this: NeoBundle 'bling/vim-airline', {'rev' : 'master', 'name' : 'airline'} the problem disappears. Why do I need to specify the branch?

@Shougo
Copy link
Owner

Shougo commented Mar 9, 2015

I think you checkouted the commit in the repository.
If you set 'rev', neobundle execute "git checkout master" automatically.

@petobens
Copy link

@Shougo I don't know why this happened (I never checkouted a commit) but doing git checkout master fixes my problem. Sorry for the noise and thanks for the help.

@junkblocker
Copy link

I am having this problem with YouCompleteMe, UltiSnips and Syntastic. I do weekly updates and these three always run into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants