Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin.git_status doesn't handle quoted file names #3284

Open
Lattay opened this issue Sep 10, 2024 · 2 comments · May be fixed by #3292
Open

builtin.git_status doesn't handle quoted file names #3284

Lattay opened this issue Sep 10, 2024 · 2 comments · May be fixed by #3292
Labels
bug Something isn't working

Comments

@Lattay
Copy link

Lattay commented Sep 10, 2024

Description

If git status produces a quoted file name (if the file name contain a space for example) the builtin picker git_status will not parse the result properly and include literal quotes in the file name.

Neovim version

NVIM v0.11.0-dev-720b309c7-dirty
Build type: Release
LuaJIT 2.1.1720049189

Operating system and version

Arch

Telescope version / branch / rev

master, current commit 5972437

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 14.1.0
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

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

Telescope Extension: `file_browser` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

With minimal.lua in home directory.

mkdir repro
cd repro
git init
echo "test file" > 'file with space.txt'
nvim -nu ~/minimal.lua

Then do :lua require("telescope.builtin").git_status(), type file and <CR>.

Expected behavior

Navigate to the file file with space.txt.

Actual behavior

A new buffer named "file with space.txt" is open.

Minimal config

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.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
@Lattay Lattay added the bug Something isn't working label Sep 10, 2024
@Lattay
Copy link
Author

Lattay commented Sep 10, 2024

I am going to investigate the bug myself and try to fix it, but right now I just have time for the report.

@Lattay Lattay linked a pull request Sep 12, 2024 that will close this issue
4 tasks
@Lattay
Copy link
Author

Lattay commented Sep 12, 2024

simple bug, easy fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant