mirror of
https://github.com/neovim/neovim.git
synced 2026-07-13 12:50:31 +00:00
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.
This commit is contained in:
@@ -591,21 +591,23 @@ end
|
|||||||
--- @async
|
--- @async
|
||||||
--- @param p vim.pack.Plug
|
--- @param p vim.pack.Plug
|
||||||
local function infer_update_details(p)
|
local function infer_update_details(p)
|
||||||
|
p.info.update_details = ''
|
||||||
infer_states(p)
|
infer_states(p)
|
||||||
local sha_head = assert(p.info.sha_head)
|
local sha_head = assert(p.info.sha_head)
|
||||||
local sha_target = assert(p.info.sha_target)
|
local sha_target = assert(p.info.sha_target)
|
||||||
|
|
||||||
-- Try showing log of changes (if any)
|
-- Try showing log of changes (if any)
|
||||||
if sha_head ~= sha_target then
|
if sha_head ~= sha_target then
|
||||||
-- `--topo-order` makes showing divergent branches nicer
|
local range = sha_head .. '...' .. sha_target
|
||||||
-- `--decorate-refs` shows only tags near commits (not `origin/main`, etc.)
|
local format = '--pretty=format:%m %h │ %s%d'
|
||||||
p.info.update_details = git_cmd({
|
-- Show only tags near commits (not `origin/main`, etc.)
|
||||||
'log',
|
local decorate = '--decorate-refs=refs/tags'
|
||||||
'--pretty=format:%m %h │ %s%d',
|
-- `--topo-order` makes showing divergent branches nicer, but by itself
|
||||||
'--topo-order',
|
-- doesn't ensure that reverted ("left", shown with `<`) and added
|
||||||
'--decorate-refs=refs/tags',
|
-- ("right", shown with `>`) commits have fixed order.
|
||||||
sha_head .. '...' .. sha_target,
|
local l = git_cmd({ 'log', format, '--topo-order', '--left-only', decorate, range }, p.path)
|
||||||
}, 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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user