Skip to content

Commit c880254

Browse files
TamaMcGlinnrbong
authored andcommitted
Fix #87 open buffer not cwd
Somewhere the past months some refactoring caused us to grab the git dir from fugitive AFTER opening a fresh new buffer for the flog graph, causing it to always fall back to the current working dir instead of the desired behaviour, which matches :Git in using the current buffer when possible.
1 parent bce44d8 commit c880254

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autoload/flog.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ function! flog#get_fugitive_git_dir() abort
190190
endfunction
191191

192192
function! flog#trigger_fugitive_git_detection() abort
193-
let b:git_dir = flog#get_fugitive_git_dir()
194193
let l:workdir = flog#get_state().workdir
195194
call FugitiveDetect(l:workdir)
196195
endfunction
@@ -1653,6 +1652,9 @@ endfunction
16531652
" Graph layout management {{{
16541653

16551654
function! flog#open_graph(state) abort
1655+
" grab git dir before opening a new buffer so we still have the opened file
1656+
let b:git_dir = flog#get_fugitive_git_dir()
1657+
16561658
let l:window_name = 'flog-' . a:state.instance . ' [uninitialized]'
16571659
silent exec a:state.open_cmd . ' ' . l:window_name
16581660

0 commit comments

Comments
 (0)