| 12345678910111213141516171819202122232425262728 |
- local M = {}
- function M.resolve_git_path(buf_id)
- local bufname = vim.api.nvim_buf_get_name(buf_id)
- if not vim.startswith(bufname, 'fugitive://') then
- return false
- end
- local parsed = vim.fn.FugitiveParse(bufname)
- local resolved_path = parsed[1]
- local repo = parsed[2]
- if resolved_path == '' then
- return false
- end
- local parts = vim.split(resolved_path, ':')
- local commit = parts[1]
- local path = parts[2]
- return {
- repo = repo,
- commit = commit,
- path = path,
- }
- end
- return M
|