Skip to content

Commit

Permalink
fix: cache opts.cwd so it cannot be changed by another function
Browse files Browse the repository at this point in the history
  • Loading branch information
entropitor committed Mar 19, 2024
1 parent b4c0b70 commit a928de0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/telescope/_extensions/repo/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ local function gen_from_fd(opts)
items = { {} },
})

local cwd = opts.cwd
local function make_display(entry)
local dir = (function(path)
if path == Path.path.root() then
Expand All @@ -83,8 +84,8 @@ local function gen_from_fd(opts)
return p:shorten()
end

if vim.startswith(path, opts.cwd) and path ~= opts.cwd then
return Path:new(p):make_relative(opts.cwd)
if vim.startswith(path, cwd) and path ~= cwd then
return Path:new(p):make_relative(cwd)
end

if vim.startswith(path, os_home) then
Expand Down

0 comments on commit a928de0

Please sign in to comment.