diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-01-15 09:27:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-15 09:27:46 +0100 |
| commit | e08a5b13312495fe6534b0c9b89cc0ffe06b7079 (patch) | |
| tree | 87f56389eb3af4a411ef119d643b84815f4b4acf /lua/telescope/builtin/git.lua | |
| parent | 57012550977679925176819345adc4d0dce85a00 (diff) | |
feat: show git log for remote branches (#428)
Diffstat (limited to 'lua/telescope/builtin/git.lua')
| -rw-r--r-- | lua/telescope/builtin/git.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua index c2d31c6..c30625e 100644 --- a/lua/telescope/builtin/git.lua +++ b/lua/telescope/builtin/git.lua @@ -28,8 +28,7 @@ git.files = function(opts) end git.commits = function(opts) - local cmd = 'git log --pretty=oneline --abbrev-commit' - local results = vim.split(utils.get_os_command_output(cmd), '\n') + local results = utils.get_os_command_output({ 'git', 'log', '--pretty=oneline', '--abbrev-commit' }) pickers.new(opts, { prompt_title = 'Git Commits', @@ -47,8 +46,9 @@ git.commits = function(opts) end git.bcommits = function(opts) - local cmd = 'git log --pretty=oneline --abbrev-commit ' .. vim.fn.expand('%') - local results = vim.split(utils.get_os_command_output(cmd), '\n') + local results = utils.get_os_command_output({ + 'git', 'log', '--pretty=oneline', '--abbrev-commit', vim.fn.expand('%') + }) pickers.new(opts, { prompt_title = 'Git BCommits', @@ -68,7 +68,7 @@ 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 = vim.split(utils.get_os_command_output('git branch --all'), '\n') + local output = utils.get_os_command_output({ 'git', 'branch', '--all' }) local tmp_results = {} for _, v in ipairs(output) do @@ -106,9 +106,9 @@ 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' } - if output == '' then + if table.getn(output) == 0 then print('No changes found') return end @@ -116,7 +116,7 @@ git.status = function(opts) pickers.new(opts, { prompt_title = 'Git Status', finder = finders.new_table { - results = vim.split(output, '\n'), + results = output, entry_maker = make_entry.gen_from_git_status(opts) }, previewer = previewers.git_file_diff.new(opts), |
