fix(log): Correctly pass revsets to the new command from visual mode

This commit is contained in:
NicolasGB
2026-07-13 10:41:52 +02:00
parent 0cbccf3e3c
commit 2af8f0d80a
2 changed files with 17 additions and 16 deletions
+5 -2
View File
@@ -466,7 +466,10 @@ function M.handle_log_new(flag, ignore_immut)
table.insert(cmd, rev)
end
else
table.insert(cmd, revsets)
-- Revsets should always be inserted 1 by one
for rev in revsets:gmatch("%S+") do
table.insert(cmd, rev)
end
end
if ignore_immut then
table.insert(cmd, "--ignore-immutable")
@@ -475,7 +478,7 @@ function M.handle_log_new(flag, ignore_immut)
runner.execute_async(cmd, function()
utils.notify(string.format(cfg.ok, revsets), vim.log.levels.INFO)
-- Refresh the log buffer after creating the change.
require("jj.cmd").log()
M.log()
end, string.format(cfg.err, revsets))
end
+12 -14
View File
@@ -456,13 +456,16 @@ run_test("status line: parses rename with brace group at end", function()
end)
run_test("status line: parses rename with brace group mid-path", function()
assert_table_equals({
old_path = "Business/OAuth/Exceptions/OAuth2RefreshTokenExpiredException.php",
new_path = "Business/OAuth2/Exceptions/OAuth2RefreshTokenExpiredException.php",
is_rename = true,
}, parser.parse_file_info_from_status_line(
"R Business/{OAuth => OAuth2}/Exceptions/OAuth2RefreshTokenExpiredException.php"
))
assert_table_equals(
{
old_path = "Business/OAuth/Exceptions/OAuth2RefreshTokenExpiredException.php",
new_path = "Business/OAuth2/Exceptions/OAuth2RefreshTokenExpiredException.php",
is_rename = true,
},
parser.parse_file_info_from_status_line(
"R Business/{OAuth => OAuth2}/Exceptions/OAuth2RefreshTokenExpiredException.php"
)
)
end)
run_test("status line: parses rename with empty old side mid-path", function()
@@ -498,15 +501,10 @@ end)
print("\n=== Running parse_default_cmd tests ===\n")
run_test("parse_default_cmd: parses config list array output", function()
local output = 'ui.default-command = ["log", "--no-pager", "--limit", "18"]'
local output = '["log", "--no-pager", "--limit", "18"]'
assert_table_equals({ "log", "--no-pager", "--limit", "18" }, parser.parse_json_command(output))
end)
run_test("parse_default_cmd: parses config list single string output", function()
local output = 'ui.default-command = "log"'
assert_table_equals({ "log" }, parser.parse_json_command(output))
end)
run_test("parse_default_cmd: parses bare array (config get format)", function()
local output = '["log", "--limit", "10"]'
assert_table_equals({ "log", "--limit", "10" }, parser.parse_json_command(output))
@@ -519,7 +517,7 @@ end)
run_test("parse_default_cmd: parses unquoted string", function()
local output = "log"
assert_table_equals({ "log" }, parser.parse_json_command(output))
assert_is_nil(parser.parse_json_command(output))
end)
run_test("parse_default_cmd: returns nil for empty string", function()