mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 14:23:51 -05:00
Decamelize s:ExtractGitDir
Rule of thumb: reserve camel case for imperative functions.
This commit is contained in:
@@ -107,7 +107,7 @@ let s:abstract_prototype = {}
|
|||||||
" }}}1
|
" }}}1
|
||||||
" Initialization {{{1
|
" Initialization {{{1
|
||||||
|
|
||||||
function! s:ExtractGitDir(path) abort
|
function! s:extract_git_dir(path) abort
|
||||||
let path = s:shellslash(a:path)
|
let path = s:shellslash(a:path)
|
||||||
if path =~? '^fugitive://.*//'
|
if path =~? '^fugitive://.*//'
|
||||||
return matchstr(path,'fugitive://\zs.\{-\}\ze//')
|
return matchstr(path,'fugitive://\zs.\{-\}\ze//')
|
||||||
@@ -132,7 +132,7 @@ function! s:Detect(path)
|
|||||||
unlet b:git_dir
|
unlet b:git_dir
|
||||||
endif
|
endif
|
||||||
if !exists('b:git_dir')
|
if !exists('b:git_dir')
|
||||||
let dir = s:ExtractGitDir(a:path)
|
let dir = s:extract_git_dir(a:path)
|
||||||
if dir != ''
|
if dir != ''
|
||||||
let b:git_dir = dir
|
let b:git_dir = dir
|
||||||
endif
|
endif
|
||||||
@@ -169,7 +169,7 @@ let s:repo_prototype = {}
|
|||||||
let s:repos = {}
|
let s:repos = {}
|
||||||
|
|
||||||
function! s:repo(...) abort
|
function! s:repo(...) abort
|
||||||
let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : s:ExtractGitDir(expand('%:p')))
|
let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : s:extract_git_dir(expand('%:p')))
|
||||||
if dir !=# ''
|
if dir !=# ''
|
||||||
if has_key(s:repos,dir)
|
if has_key(s:repos,dir)
|
||||||
let repo = get(s:repos,dir)
|
let repo = get(s:repos,dir)
|
||||||
@@ -1918,7 +1918,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:FileRead()
|
function! s:FileRead()
|
||||||
try
|
try
|
||||||
let repo = s:repo(s:ExtractGitDir(expand('<amatch>')))
|
let repo = s:repo(s:extract_git_dir(expand('<amatch>')))
|
||||||
let path = s:sub(s:sub(matchstr(expand('<amatch>'),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&')
|
let path = s:sub(s:sub(matchstr(expand('<amatch>'),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&')
|
||||||
let hash = repo.rev_parse(path)
|
let hash = repo.rev_parse(path)
|
||||||
if path =~ '^:'
|
if path =~ '^:'
|
||||||
|
|||||||
Reference in New Issue
Block a user