mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-15 23:53:18 +00:00
fix(filesets): Correclty escape filesets in different commands to avoid
special characters breaking jj's parsing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user