Skip to content

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

@rafi

Description

@rafi

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..

Activity

Shougo

Shougo commented on Sep 9, 2014

@Shougo
Owner

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

rafi commented on Sep 10, 2014

@rafi
Author

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 commented on Sep 10, 2014

@Shougo
Owner

Fixed the problem by C.

petobens

petobens commented on Mar 9, 2015

@petobens

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

Shougo commented on Mar 9, 2015

@Shougo
Owner

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

petobens

petobens commented on Mar 10, 2015

@petobens

@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

junkblocker commented on Aug 7, 2015

@junkblocker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @junkblocker@Shougo@rafi@petobens

        Issue actions

          Update error for plugins with the 'rev' indicator · Issue #310 · Shougo/neobundle.vim