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
+4 -3
View File
@@ -16,8 +16,8 @@ function M.handle_status_restore()
if file_info.is_rename then
-- For renamed files, remove the new file and restore the old one from parent revision
local rm_cmd = "rm " .. vim.fn.shellescape(file_info.new_path)
local restore_cmd = "jj restore --from @- " .. vim.fn.shellescape(file_info.old_path)
local rm_cmd = string.format("rm %s", vim.fn.shellescape(file_info.new_path))
local restore_cmd = string.format("jj restore --from @- %s", utils.escape_fileset(file_info.old_path))
local _, rm_success = runner.execute_command(rm_cmd, "Failed to remove renamed file")
if rm_success then
@@ -32,7 +32,8 @@ function M.handle_status_restore()
end
else
-- For non-renamed files, use regular restore
local restore_cmd = "jj restore " .. vim.fn.shellescape(file_info.old_path)
utils.notify(utils.escape_fileset(file_info.old_path))
local restore_cmd = string.format("jj restore %s", utils.escape_fileset(file_info.old_path))
local _, success = runner.execute_command(restore_cmd, "Failed to restore")
if success then