From 0d6cd47990781ea760dd3db578015c140c7b9fa7 Mon Sep 17 00:00:00 2001 From: PolarMutex <115141+polarmutex@users.noreply.github.com> Date: Thu, 22 Apr 2021 13:23:42 -0400 Subject: fix checking for git dir in a bare repo (#757) * fix checking for git dir in a bare repo * revert last change and look for worktree * fix lint error * [docgen] Update doc/telescope.txt skip-checks: true Co-authored-by: Brian Ryall Co-authored-by: Github Actions --- lua/telescope/builtin/git.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua index 198abae..d708126 100644 --- a/lua/telescope/builtin/git.lua +++ b/lua/telescope/builtin/git.lua @@ -244,7 +244,10 @@ local set_opts_cwd = function(opts) local use_git_root = utils.get_default(opts.use_git_root, true) if ret ~= 0 then - error(opts.cwd .. ' is not a git directory') + local is_worktree = utils.get_os_command_output({ "git", "rev-parse", "--is-inside-work-tree" }, opts.cwd) + if is_worktree == "false" then + error(opts.cwd .. ' is not a git directory') + end else if use_git_root then opts.cwd = git_root[1] -- cgit v1.2.3