From 13fdeb5fa7f464266163f405f42322e6fb0d3067 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 17 Nov 2019 22:17:34 -0500 Subject: [PATCH] Don't show bogus unstaged changes in bare repository References https://github.com/tpope/vim-fugitive/pull/1262 --- autoload/fugitive.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 67c8647..2b05056 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1724,6 +1724,10 @@ function! fugitive#BufReadStatus() abort endwhile endif + if empty(s:Tree()) + let [unstaged, untracked] = [[], []] + endif + for dict in staged let b:fugitive_files['Staged'][dict.filename] = dict endfor @@ -1820,6 +1824,9 @@ function! fugitive#BufReadStatus() abort if push !=# pull call s:AddHeader('Push', push) endif + if empty(s:Tree()) + call s:AddHeader('Bare', 'yes') + endif call s:AddSection('Rebasing ' . rebasing_head, rebasing) call s:AddSection('Untracked', untracked) call s:AddSection('Unstaged', unstaged)