diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua index c403f14..a296517 100644 --- a/lua/telescope/builtin/git.lua +++ b/lua/telescope/builtin/git.lua @@ -37,7 +37,9 @@ git.files = function(opts) end git.commits = function(opts) - local results = utils.get_os_command_output({ 'git', 'log', '--pretty=oneline', '--abbrev-commit' }, opts.cwd) + local results = utils.get_os_command_output({ + 'git', 'log', '--pretty=oneline', '--abbrev-commit', '--', '.' + }, opts.cwd) pickers.new(opts, { prompt_title = 'Git Commits', @@ -110,7 +112,7 @@ end git.status = function(opts) local gen_new_finder = function() - local output = utils.get_os_command_output({ 'git', 'status', '-s' }, opts.cwd) + local output = utils.get_os_command_output({ 'git', 'status', '-s', '--', '.' }, opts.cwd) if table.getn(output) == 0 then print('No changes found') @@ -154,11 +156,14 @@ local set_opts_cwd = function(opts) -- Find root of git directory and remove trailing newline characters local git_root = vim.fn.systemlist("git -C " .. opts.cwd .. " rev-parse --show-toplevel")[1] + local use_git_root = utils.get_default(opts.use_git_root, true) if vim.v.shell_error ~= 0 then error(opts.cwd .. ' is not a git directory') else - opts.cwd = git_root + if use_git_root then + opts.cwd = git_root + end end end