summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/git.lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2021-02-09 18:25:57 +0100
committerGitHub <noreply@github.com>2021-02-09 18:25:57 +0100
commit3a7fa41857394cd2d90d00891413c12fada039c3 (patch)
treebff862cb4e8f3623fe167f1105e9f1dac72dfb95 /lua/telescope/builtin/git.lua
parent993e383dd5356bf10c5cf2b5d0ac88f9c7746181 (diff)
fix: all git builtin respect cwd now (#517)
Diffstat (limited to 'lua/telescope/builtin/git.lua')
-rw-r--r--lua/telescope/builtin/git.lua16
1 files changed, 5 insertions, 11 deletions
diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua
index a33e76b..a9dbfab 100644
--- a/lua/telescope/builtin/git.lua
+++ b/lua/telescope/builtin/git.lua
@@ -36,7 +36,7 @@ git.files = function(opts)
end
git.commits = function(opts)
- local results = utils.get_os_command_output({ 'git', 'log', '--pretty=oneline', '--abbrev-commit' })
+ local results = utils.get_os_command_output({ 'git', 'log', '--pretty=oneline', '--abbrev-commit' }, opts.cwd)
pickers.new(opts, {
prompt_title = 'Git Commits',
@@ -56,7 +56,7 @@ end
git.bcommits = function(opts)
local results = utils.get_os_command_output({
'git', 'log', '--pretty=oneline', '--abbrev-commit', vim.fn.expand('%')
- })
+ }, opts.cwd)
pickers.new(opts, {
prompt_title = 'Git BCommits',
@@ -74,9 +74,7 @@ git.bcommits = function(opts)
end
git.branches = function(opts)
- -- Does this command in lua (hopefully):
- -- 'git branch --all | grep -v HEAD | sed "s/.* //;s#remotes/[^/]*/##" | sort -u'
- local output = utils.get_os_command_output({ 'git', 'branch', '--all' })
+ local output = utils.get_os_command_output({ 'git', 'branch', '--all' }, opts.cwd)
local tmp_results = {}
for _, v in ipairs(output) do
@@ -97,11 +95,7 @@ git.branches = function(opts)
finder = finders.new_table {
results = results,
entry_maker = function(entry)
- return {
- value = entry,
- ordinal = entry,
- display = entry,
- }
+ return { value = entry, ordinal = entry, display = entry, }
end
},
previewer = previewers.git_branch_log.new(opts),
@@ -114,7 +108,7 @@ git.branches = function(opts)
end
git.status = function(opts)
- local output = utils.get_os_command_output{ 'git', 'status', '-s' }
+ local output = utils.get_os_command_output({ 'git', 'status', '-s' }, opts.cwd)
if table.getn(output) == 0 then
print('No changes found')