Skip to content

Commit

Permalink
fix: allow cached opts.cwd to be reset if nil
Browse files Browse the repository at this point in the history
Sometimes, when we cache opts.cwd, it is still nil. While this problem
is investigated [separately][1], it’s worth having this workaround, to
be on the safe side. It’s very disruptive when items can’t be diplayed.

[1]: #70 (comment)

Originally authored by @rish987 in #71. I’ve made cosmetic changes and
added some comments.

Co-authored-by: Rishikesh Vaishnav <rishhvaishnav@gmail.com>
  • Loading branch information
cljoly and rish987 committed Apr 25, 2024
1 parent ca8a541 commit 36720ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/telescope/_extensions/repo/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ local function gen_from_fd(opts)
-- display function
local cwd = opts.cwd
local function make_display(entry)
-- The value `opts.cwd` might have been nil when it was fixed. This
-- resets it if it was nil.
if not cwd then
cwd = opts.cwd
end
local dir = (function(path)
if path == Path.path.root() then
return path
Expand Down

0 comments on commit 36720ed

Please sign in to comment.