diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-08-02 14:58:17 +0300 |
|---|---|---|
| committer | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-08-02 15:00:42 +0300 |
| commit | d3bea4ace94a16e75f7dfe609fba0ae9e5775308 (patch) | |
| tree | a21b4c28f6c8733f920bb6d87976934bd2490932 /runtime/lua/vim/pack.lua | |
| parent | 89a72f11e5fe8c06a2b8e8ae994359d3316ee576 (diff) | |
| download | rneovim-d3bea4ace94a16e75f7dfe609fba0ae9e5775308.tar.gz rneovim-d3bea4ace94a16e75f7dfe609fba0ae9e5775308.tar.bz2 rneovim-d3bea4ace94a16e75f7dfe609fba0ae9e5775308.zip | |
fix(pack): ensure consistent order of changelog during update
Problem: Left (`<` prefix) and right (`>` prefix) parts of update
changelog come in not fixed order: it can be left-right or right-left.
Solution: Ensure left-right order.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
| -rw-r--r-- | runtime/lua/vim/pack.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index db3777103f..d793b36a0e 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -591,21 +591,23 @@ end --- @async --- @param p vim.pack.Plug local function infer_update_details(p) + p.info.update_details = '' infer_states(p) local sha_head = assert(p.info.sha_head) local sha_target = assert(p.info.sha_target) -- Try showing log of changes (if any) if sha_head ~= sha_target then - -- `--topo-order` makes showing divergent branches nicer - -- `--decorate-refs` shows only tags near commits (not `origin/main`, etc.) - p.info.update_details = git_cmd({ - 'log', - '--pretty=format:%m %h │ %s%d', - '--topo-order', - '--decorate-refs=refs/tags', - sha_head .. '...' .. sha_target, - }, p.path) + local range = sha_head .. '...' .. sha_target + local format = '--pretty=format:%m %h │ %s%d' + -- Show only tags near commits (not `origin/main`, etc.) + local decorate = '--decorate-refs=refs/tags' + -- `--topo-order` makes showing divergent branches nicer, but by itself + -- doesn't ensure that reverted ("left", shown with `<`) and added + -- ("right", shown with `>`) commits have fixed order. + local l = git_cmd({ 'log', format, '--topo-order', '--left-only', decorate, range }, p.path) + local r = git_cmd({ 'log', format, '--topo-order', '--right-only', decorate, range }, p.path) + p.info.update_details = l == '' and r or (r == '' and l or (l .. '\n' .. r)) return end |