fix(filesets): Correclty escape filesets in different commands to avoid

special characters breaking jj's parsing
This commit is contained in:
NicolasGB
2026-06-30 12:45:40 +02:00
committed by Nicolas GB
parent db06e9a73c
commit c724290141
5 changed files with 31 additions and 10 deletions
+10
View File
@@ -982,4 +982,14 @@ function M.open_first_conflicted_file(revset)
end
end
--- Build a shell-safe jj fileset argument for a literal path.
--- jj path arguments use fileset syntax, so special characters like `$`
--- must be wrapped in jj string quotes before shell-escaping.
---@param path string
---@return string
function M.escape_fileset(path)
local fileset_literal = string.format('"%s"', path:gsub("\\", "\\\\"):gsub('"', '\\"'))
return vim.fn.shellescape(fileset_literal)
end
return M