From 47eadb71f6a461edb400f5215286dcb82047de51 Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Tue, 26 Feb 2008 21:24:30 +0000 Subject: [PATCH] Tweaked buffer info for git buffers. Handle detached head by showing 'DETACHED' for branch. Add output of 'git describe --all' to buffer info. git-svn-id: https://vcscommand.googlecode.com/svn/trunk@67 e7462f97-9721-0410-a4e7-d7c98e439057 --- plugin/vcsgit.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugin/vcsgit.vim b/plugin/vcsgit.vim index e2a85a4..003e4a5 100644 --- a/plugin/vcsgit.vim +++ b/plugin/vcsgit.vim @@ -171,9 +171,16 @@ endfunction function! s:gitFunctions.GetBufferInfo() let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%'))) try - let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref HEAD'), '\n$', '', '') - let branch = substitute(branch, '^refs/heads/', '', '') - return[branch] + let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref -q HEAD'), '\n$', '', '') + if v:shell_error + let branch = 'DETACHED' + else + let branch = substitute(branch, '^refs/heads/', '', '') + endif + + let description = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe --all'), '\n$', '', '') + + return[branch, description] finally call VCSCommandChdir(oldCwd) endtry -- 2.11.4.GIT