Skip to content

Commit 471f596

Browse files
committed
Fix plumbing inside .git/ repo dirs
It only worked in git's special files (e.g. rebase scripts and commit msgs) and not in the scratch bufs created from them.
1 parent 9757771 commit 471f596

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

plugin/acme.vim

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,32 +532,32 @@ function s:Dir()
532532
endfunc
533533

534534
function s:Dirs()
535-
let dirs = [s:Dir()]
535+
let dir = s:Dir()
536+
let ctx = []
536537
if &buftype != ''
537538
let [t, q] = ['ing directory:? ', "[`'\"]"]
538539
let l = searchpair('\vEnter'.t.q, '', '\vLeav'.t.q, 'nW',
539540
\ '', 0, 50)
540541
let m = matchlist(getline(l), '\vLeav'.t.q.'(.+)'.q)
541542
if m != []
542-
let d = m[1][0] == '/' ? m[1] : dirs[0].'/'.m[1]
543+
let d = m[1][0] == '/' ? m[1] : dir.'/'.m[1]
543544
if isdirectory(d)
544-
let dirs[0] = d
545+
call add(ctx, d)
545546
endif
546547
endif
547548
endif
548-
let path = expand('%:p')
549-
if path =~ '/\.git/'
550-
let owd = chdir(dirs[0])
549+
if dir =~ '/\.git/'
550+
let owd = chdir(dir)
551551
let d = trim(system('git rev-parse --show-toplevel'), "\r\n")
552552
if owd != ''
553553
call chdir(owd)
554554
endif
555555
if !isdirectory(d)
556-
let d = substitute(path, '/\.git/.*', '', '')
556+
let d = substitute(dir, '/\.git/.*', '', '')
557557
endif
558-
call add(dirs, d)
558+
call add(ctx, d)
559559
endif
560-
return dirs
560+
return ctx + [dir]
561561
endfunc
562562

563563
function AcmeOpen(name, pos)

0 commit comments

Comments
 (0)