mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-10 04:23:46 -05:00
Move FugitiveParse() implementation into autoload file
Anticipating changes here, so let's try to avoid the dreaded "old plugin file loads new autoload file" edge case burning us.
This commit is contained in:
@@ -1626,6 +1626,10 @@ function! s:DirRev(url) abort
|
|||||||
return [dir, commit . file ==# '/.git/index' ? ':' : (!empty(dir) && commit =~# '^.$' ? ':' : '') . commit . substitute(file, '^/', ':', '')]
|
return [dir, commit . file ==# '/.git/index' ? ':' : (!empty(dir) && commit =~# '^.$' ? ':' : '') . commit . substitute(file, '^/', ':', '')]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#Parse(url) abort
|
||||||
|
return reverse(s:DirRev(a:url))
|
||||||
|
endfunction
|
||||||
|
|
||||||
let s:merge_heads = ['MERGE_HEAD', 'REBASE_HEAD', 'CHERRY_PICK_HEAD', 'REVERT_HEAD']
|
let s:merge_heads = ['MERGE_HEAD', 'REBASE_HEAD', 'CHERRY_PICK_HEAD', 'REVERT_HEAD']
|
||||||
function! s:MergeHead(dir) abort
|
function! s:MergeHead(dir) abort
|
||||||
let dir = fugitive#Find('.git/', a:dir)
|
let dir = fugitive#Find('.git/', a:dir)
|
||||||
|
|||||||
@@ -91,12 +91,11 @@ function! FugitiveParse(...) abort
|
|||||||
if path !~# '^fugitive://'
|
if path !~# '^fugitive://'
|
||||||
return ['', '']
|
return ['', '']
|
||||||
endif
|
endif
|
||||||
let vals = matchlist(path, s:dir_commit_file)
|
let [rev, dir] = fugitive#Parse(path)
|
||||||
if len(vals)
|
if !empty(dir)
|
||||||
return [(vals[2] =~# '^.\=$' ? ':' : '') . vals[2] . substitute(vals[3], '^/', ':', ''), vals[1]]
|
return [rev, dir]
|
||||||
endif
|
endif
|
||||||
let v:errmsg = 'fugitive: invalid Fugitive URL ' . path
|
throw 'fugitive: invalid Fugitive URL ' . path
|
||||||
throw v:errmsg
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveGitVersion() queries the version of Git in use. Pass up to 3
|
" FugitiveGitVersion() queries the version of Git in use. Pass up to 3
|
||||||
@@ -430,7 +429,7 @@ function! FugitiveExtractGitDir(path) abort
|
|||||||
let path = s:Slash(a:path)
|
let path = s:Slash(a:path)
|
||||||
endif
|
endif
|
||||||
if path =~# '^fugitive://'
|
if path =~# '^fugitive://'
|
||||||
return get(matchlist(path, s:dir_commit_file), 1, '')
|
return fugitive#Parse(path)[1]
|
||||||
elseif empty(path)
|
elseif empty(path)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
@@ -486,8 +485,6 @@ endfunction
|
|||||||
|
|
||||||
if exists('+shellslash')
|
if exists('+shellslash')
|
||||||
|
|
||||||
let s:dir_commit_file = '\c^fugitive://\%(/\a\@=\)\=\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
|
|
||||||
|
|
||||||
function! s:Slash(path) abort
|
function! s:Slash(path) abort
|
||||||
return tr(a:path, '\', '/')
|
return tr(a:path, '\', '/')
|
||||||
endfunction
|
endfunction
|
||||||
@@ -502,8 +499,6 @@ if exists('+shellslash')
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
let s:dir_commit_file = '\c^fugitive://\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
|
|
||||||
|
|
||||||
function! s:Slash(path) abort
|
function! s:Slash(path) abort
|
||||||
return a:path
|
return a:path
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user