|
692 | 692 | --- Generate release notes between two tags
|
693 | 693 | ---@param from_tag string|nil Starting tag (if not provided, uses second latest tag)
|
694 | 694 | ---@param to_tag string|nil Ending tag (if not provided, uses latest tag)
|
695 |
| ----@param format string|nil Format for release notes (markdown, plain, json) |
| 695 | +---@param format string|nil Format (markdown, plain, json) |
696 | 696 | ---@return boolean success
|
697 | 697 | ---@return string output
|
698 | 698 | ---@return string user_msg
|
@@ -740,7 +740,14 @@ function GitTool.generate_release_notes(from_tag, to_tag, format)
|
740 | 740 |
|
741 | 741 | -- Get commit range between tags
|
742 | 742 | local range = from_tag .. ".." .. to_tag
|
743 |
| - local commit_cmd = "git log --pretty=format:'%h\x01%s\x01%an\x01%ad' --date=short " .. vim.fn.shellescape(range) |
| 743 | + local escaped_range = vim.fn.shellescape(range) |
| 744 | + if not escaped_range or escaped_range == "" then |
| 745 | + local msg = "Failed to escape tag range: " .. range |
| 746 | + local user_msg = msg |
| 747 | + local llm_msg = "<gitReleaseNotes>fail: " .. msg .. "</gitReleaseNotes>" |
| 748 | + return false, msg, user_msg, llm_msg |
| 749 | + end |
| 750 | + local commit_cmd = "git log --pretty=format:'%h\x01%s\x01%an\x01%ad' --date=short " .. escaped_range |
744 | 751 | local success_commits, commits_output = pcall(vim.fn.system, commit_cmd)
|
745 | 752 |
|
746 | 753 | if not success_commits or vim.v.shell_error ~= 0 then
|
|
0 commit comments