mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 14:53:51 -05:00
Make summary buffer available at fugitive:// URL
Using $GIT_DIR/index for the summary buffer has 2 problems: * It requires a BufReadCmd for all files named "index", necessitating special handling for false positives. * It forces us to resolve ".git" files and symlinks, decoupling us from the worktree and thus forcing us to depend on `core.worktree`. Git always sets this when necessary, but users and third-party tooling sometimes do not. Using a fugitive:// URL for the buffer solves both. This is a large, breaking change, so let's leave $GIT_DIR/index as the default for now.
This commit is contained in:
@@ -91,9 +91,9 @@ function! FugitiveParse(...) abort
|
||||
if path !~# '^fugitive:'
|
||||
return ['', '']
|
||||
endif
|
||||
let vals = matchlist(path, '\c^fugitive:\%(//\)\=\(.\{-\}\)\%(//\|::\)\(\x\{40,\}\|[0-3]\)\(/.*\)\=$')
|
||||
let vals = matchlist(path, '\c^fugitive://\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$')
|
||||
if len(vals)
|
||||
return [(vals[2] =~# '^.$' ? ':' : '') . vals[2] . substitute(vals[3], '^/', ':', ''), vals[1]]
|
||||
return [(vals[2] =~# '^.\=$' ? ':' : '') . vals[2] . substitute(vals[3], '^/', ':', ''), vals[1]]
|
||||
endif
|
||||
let v:errmsg = 'fugitive: invalid Fugitive URL ' . path
|
||||
throw v:errmsg
|
||||
|
||||
Reference in New Issue
Block a user