diff options
| author | PolarMutex <115141+polarmutex@users.noreply.github.com> | 2021-04-22 13:23:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 13:23:42 -0400 |
| commit | 0d6cd47990781ea760dd3db578015c140c7b9fa7 (patch) | |
| tree | 380542639e59f15ccdbb22c3d096473a0684d968 | |
| parent | 3adeab2bed42597c8495fbe3a2376c746232f2e3 (diff) | |
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 <brian.ryall@udri.udayton.edu>
Co-authored-by: Github Actions <actions@github>
| -rw-r--r-- | doc/telescope.txt | 64 | ||||
| -rw-r--r-- | lua/telescope/builtin/git.lua | 5 |
2 files changed, 52 insertions, 17 deletions
diff --git a/doc/telescope.txt b/doc/telescope.txt index 02fe61a..a5885ad 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -116,22 +116,6 @@ builtin.live_grep() *builtin.live_grep()* Actions functions that are useful for people creating their own mappings. -actions.move_selection_next({prompt_bufnr}) *actions.move_selection_next()* - Move the selection to the next entry - - - Parameters: ~ - {prompt_bufnr} (number) The prompt bufnr - - -actions.move_selection_previous({prompt_bufnr})*actions.move_selection_previous()* - Move the selection to the previous entry - - - Parameters: ~ - {prompt_bufnr} (number) The prompt bufnr - - actions.move_selection_worse({prompt_bufnr}) *actions.move_selection_worse()* Move the selection to the entry that has a worse score @@ -196,6 +180,54 @@ actions.toggle_selection({prompt_bufnr}) *actions.toggle_selection()* {prompt_bufnr} (number) The prompt bufnr +actions.git_create_branch({prompt_bufnr}) *actions.git_create_branch()* + Create and checkout a new git branch if it doesn't already exist + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.git_checkout({prompt_bufnr}) *actions.git_checkout()* + Checkout an existing git branch + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.git_track_branch({prompt_bufnr}) *actions.git_track_branch()* + Tell git to track the currently selected remote branch in Telescope + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.git_delete_branch({prompt_bufnr}) *actions.git_delete_branch()* + Delete the currently selected branch + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.git_rebase_branch({prompt_bufnr}) *actions.git_rebase_branch()* + Rebase to selected git branch + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.git_staging_toggle({prompt_bufnr}) *actions.git_staging_toggle()* + Stage/unstage selected file + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + actions.open_qflist() *actions.open_qflist()* Open the quickfix list 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] |
