fix(git): follow symlinks when resolving a buffer's repo

This commit is contained in:
2026-04-30 19:37:18 +02:00
parent af7e187aa9
commit 9568fc63a3
8 changed files with 20 additions and 18 deletions
+3 -6
View File
@@ -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