diff --git a/lua/jj/cmd/log.lua b/lua/jj/cmd/log.lua index 4931173..cbe91ab 100644 --- a/lua/jj/cmd/log.lua +++ b/lua/jj/cmd/log.lua @@ -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 diff --git a/tests/run_tests.lua b/tests/run_tests.lua index 80938d6..7028c9d 100755 --- a/tests/run_tests.lua +++ b/tests/run_tests.lua @@ -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()