~tomleb/repo-url.nvim

61a52bac10f78f66b9c800c4ecbc9144b74fded5 — Tom Lebreux 7 months ago 5780578
Fix blob with github and ref
1 files changed, 6 insertions(+), 2 deletions(-)

M lua/repo-url/init.lua
M lua/repo-url/init.lua => lua/repo-url/init.lua +6 -2
@@ 31,7 31,11 @@ M.urls = {
  github = {
    blob_url = function(opts)
      local position = pos_to_path(opts, '#L%d', '#L%d-L%d')
      return string.format('%s/blob/%s/%s%s', opts.base_url, opts.ref, opts.filepath, position)
      local path = 'blob'
      if not opts.filepath or opts.filepath == '' then
        path = 'tree'
      end
      return string.format('%s/%s/%s/%s%s', opts.base_url, path, opts.ref, opts.filepath, position)
    end,
    blame_url = function(opts)
      local position = pos_to_path(opts, '#L%d', '#L%d-L%d')


@@ 185,7 189,7 @@ local function go_modcache_info(filename)

  local commit = json.Origin.Hash
  if json.Origin.Ref ~= nil then
    local match, _, tag = string.find(json.Origin.Ref, 'refs/tags/([^/]+)')
    local match, _, tag = string.find(json.Origin.Ref, '^refs/tags/(.+)$')
    if match then
      commit = tag
    end