Jump directly to commit rather than ref file in more cases
This commit is contained in:
parent
f7bcf51c56
commit
bb54881388
@ -275,23 +275,13 @@ function! s:repo_translate(spec) dict abort
|
|||||||
return 'fugitive://'.self.dir().'//'.ref
|
return 'fugitive://'.self.dir().'//'.ref
|
||||||
elseif a:spec =~# '^:'
|
elseif a:spec =~# '^:'
|
||||||
return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
|
return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
|
||||||
elseif a:spec ==# '@'
|
|
||||||
return self.dir('HEAD')
|
|
||||||
elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(refs . '../' . a:spec)
|
elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(refs . '../' . a:spec)
|
||||||
return simplify(refs . '../' . a:spec)
|
return simplify(refs . '../' . a:spec)
|
||||||
elseif filereadable(refs.a:spec)
|
elseif filereadable(refs.a:spec)
|
||||||
return refs.a:spec
|
return refs.a:spec
|
||||||
elseif filereadable(refs.'tags/'.a:spec)
|
|
||||||
return refs.'tags/'.a:spec
|
|
||||||
elseif filereadable(refs.'heads/'.a:spec)
|
|
||||||
return refs.'heads/'.a:spec
|
|
||||||
elseif filereadable(refs.'remotes/'.a:spec)
|
|
||||||
return refs.'remotes/'.a:spec
|
|
||||||
elseif filereadable(refs.'remotes/'.a:spec.'/HEAD')
|
|
||||||
return refs.'remotes/'.a:spec.'/HEAD'
|
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
let ref = self.rev_parse(matchstr(a:spec,'[^:]*'))
|
let ref = self.rev_parse(s:sub(matchstr(a:spec,'[^:]*'), '^\@%($|[^~])@=', 'HEAD'))
|
||||||
let path = s:sub(matchstr(a:spec,':.*'),'^:','/')
|
let path = s:sub(matchstr(a:spec,':.*'),'^:','/')
|
||||||
return 'fugitive://'.self.dir().'//'.ref.path
|
return 'fugitive://'.self.dir().'//'.ref.path
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
|
@ -330,13 +330,13 @@ and the work tree file for everything else. Example revisions follow.
|
|||||||
|
|
||||||
Revision Meaning ~
|
Revision Meaning ~
|
||||||
HEAD .git/HEAD
|
HEAD .git/HEAD
|
||||||
master .git/refs/heads/master
|
refs/heads/x .git/refs/heads/x
|
||||||
HEAD^{} The commit referenced by HEAD
|
@ The commit referenced by @ aka HEAD
|
||||||
HEAD^ The parent of the commit referenced by HEAD
|
master^ The parent of the commit referenced by master
|
||||||
HEAD: The tree referenced by HEAD
|
master: The tree referenced by master
|
||||||
/HEAD The file named HEAD in the work tree
|
/master The file named master in the work tree
|
||||||
Makefile The file named Makefile in the work tree
|
Makefile The file named Makefile in the work tree
|
||||||
HEAD^:Makefile The file named Makefile in the parent of HEAD
|
@^:Makefile The file named Makefile in the parent of HEAD
|
||||||
:Makefile The file named Makefile in the index (writable)
|
:Makefile The file named Makefile in the index (writable)
|
||||||
- The current file in HEAD
|
- The current file in HEAD
|
||||||
^ The current file in the previous commit
|
^ The current file in the previous commit
|
||||||
|
Loading…
Reference in New Issue
Block a user