Skip to content

Encountered an error when using git_command in git_bcommitsΒ #2517

@keaising

Description

@keaising

Description

In my use case, I use customized git_command in git_bcommits, and meet error

Error executing luv callback:
...repro/plugins/plenary.nvim/lua/plenary/async/control.lua:122: Oneshot channel can only send once
stack traceback:
        [C]: in function 'assert'
        ...repro/plugins/plenary.nvim/lua/plenary/async/control.lua:122: in function 'eof_tx'
        ...otfile/.repro/plugins/telescope.nvim/lua/telescope/_.lua:142: in function <...otfile/.repro/plugins/telescope.nvim/lua/telescope/_.lua:136>

But if I use default command, it's ok

My customized command:

git log --date="format:%y/%m/%d" --pretty="format:%C(auto) %h %ad %s"

Default command in Telescope

git log --pretty=oneline --abbrev-commit

I think maybe my customized command missed something needed, but I can not find the difference between the results of these two command

PS. This issue can be reliably reproduced only on some files. If you cannot reproduce it in your projects or files, please try this file https://github.com/keaising/dotfile/blob/master/nvim/.config/nvim/lua/plugins/telescope.lua , the issue can be reliably reproduced on it.

Neovim version

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Operating system and version

ArchLinux, latest

Telescope version / branch / rev

master branch

checkhealth telescope

telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Steps to reproduce

  1. git clone [email protected]:keaising/dotfile.git
  2. copy and paste minimal.lua content into minimal.lua in dotfile folder
  3. nvim -u minimal.lua nvim/.config/nvim/lua/plugins/telescope.lua
  4. Wait lazy install all plugins needed
  5. press gb can meet the error
  6. press gj will not meet the error

Expected behavior

No error

Actual behavior

Error executing luv callback:
...repro/plugins/plenary.nvim/lua/plenary/async/control.lua:122: Oneshot channel can only send once
stack traceback:
        [C]: in function 'assert'
        ...repro/plugins/plenary.nvim/lua/plenary/async/control.lua:122: in function 'eof_tx'
        ...otfile/.repro/plugins/telescope.nvim/lua/telescope/_.lua:142: in function <...otfile/.repro/plugins/telescope.nvim/lua/telescope/_.lua:136>

Minimal config

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "--single-branch",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
vim.keymap.set("n", "<Leader>e", "<Plug>(x-file-explorer)", { silent = true })
local M = {
    "nvim-telescope/telescope.nvim",
    dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-treesitter/nvim-treesitter",
    },
    config = function()
        local bufopts = { noremap = true, silent = true }
        local builtin = require("telescope.builtin")
        vim.keymap.set("n", "gb", function()
            builtin.git_bcommits({
                git_command = {
                    "git",
                    "log",
                    -- "--pretty=oneline",
                    -- "--abbrev-commit",
                    "--date=format:%y/%m/%d",
                    "--pretty=format:%C(auto) %h %ad %s",
                    "--follow",
                },
            })
        end, bufopts)
        vim.keymap.set("n", "gj", builtin.git_bcommits, bufopts)

        require("telescope").setup({})
    end,
}
local plugins = {
    M,
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions