From 302f30c9243984b62434dbd03341903e54f3cd09 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 11 Jul 2018 00:12:15 -0400 Subject: [PATCH] Handle :Gcommit % when working dir isn't Git dir --- autoload/fugitive.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 081dfa7..99b643e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -634,7 +634,7 @@ function! s:buffer(...) abort if buffer.getvar('git_dir') !=# '' return buffer endif - call s:throw('not a git repository: '.expand('%:p')) + call s:throw('not a git repository: '.bufname(buffer['#'])) endfunction function! fugitive#buffer(...) abort @@ -1239,7 +1239,14 @@ function! s:Commit(mods, args, ...) abort let args = a:args let args = s:gsub(args,'%(%(^| )-- )@'