From df221bf7d827fa103bc6b1c6cdfdeae3249e0180 Mon Sep 17 00:00:00 2001 From: Sebastian Alff <33040347+donalffons@users.noreply.github.com> Date: Sat, 18 May 2024 16:11:15 +0200 Subject: [PATCH] fix: DiffviewOpen error with white spaces in path --- lua/telescope/_extensions/git_submodules.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/telescope/_extensions/git_submodules.lua b/lua/telescope/_extensions/git_submodules.lua index ae556f3..52321f7 100644 --- a/lua/telescope/_extensions/git_submodules.lua +++ b/lua/telescope/_extensions/git_submodules.lua @@ -86,7 +86,7 @@ local function prepare_repos() for s in string.gmatch(submodules_heads, "[^" .. "\n" .. "]+") do for w in string.gmatch(s, "[^" .. " " .. "]+") do if entering == i then - repo_name = w:gsub("%'", ""):gsub("%'", "") + repo_name = (repo_name and repo_name .. " " or "") .. w:gsub("%'", ""):gsub("%'", "") elseif entering == i - 1 then repo_branch = s elseif w == "Entering" then @@ -135,7 +135,7 @@ local show_repos = function(opts) t[#t + 1] = chunk end else - local s = vim.fn.system("git -C " .. entry.value .. " status -s") + local s = vim.fn.system('git -C "' .. entry.value .. '" status -s') for chunk in string.gmatch(s, "[^\n]+") do t[#t + 1] = chunk end @@ -208,7 +208,7 @@ local show_repos = function(opts) dir = dir .. "/" .. selection end actions.close(prompt_buf) - vim.cmd(("DiffviewOpen -C%s"):format(dir)) + vim.cmd(('DiffviewOpen -C"%s"'):format(dir)) end) end return true