fix(git): follow symlinks when resolving a buffer's repo
This commit is contained in:
+3
-6
@@ -62,7 +62,7 @@ end
|
||||
---@param buf integer
|
||||
---@param rev ow.Git.Revision
|
||||
local function uri_split(opts, buf, rev)
|
||||
local worktree = vim.b[buf].git_worktree or select(2, repo.resolve_cwd())
|
||||
local worktree = vim.b[buf].git_worktree or select(2, repo.current_repo())
|
||||
if not worktree then
|
||||
util.warning("git URI buffer has no worktree")
|
||||
return
|
||||
@@ -154,16 +154,13 @@ function M.split(opts)
|
||||
util.warning("cannot diff this buffer (not a worktree file)")
|
||||
return
|
||||
end
|
||||
local _, worktree = repo.resolve(cur_path)
|
||||
local _, worktree, cur_path = repo.resolve(cur_path)
|
||||
if not worktree then
|
||||
util.warning("not in a git repository")
|
||||
return
|
||||
end
|
||||
---@cast cur_path -nil
|
||||
local rel = vim.fs.relpath(worktree, cur_path)
|
||||
if not rel then
|
||||
util.warning("file is outside the worktree")
|
||||
return
|
||||
end
|
||||
|
||||
local rev
|
||||
if not opts.rev then
|
||||
|
||||
Reference in New Issue
Block a user