aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2026-03-06 15:58:42 +0800
committerGitHub <noreply@github.com>2026-03-06 07:58:42 +0000
commitbfc7bae421feb77f2eb88bf939da413f47302880 (patch)
tree59f27b6c2d6feb65bdcfea29bb7ec4e928a4cfac /runtime/lua
parentdeadff3060df0914ce653998aa6a90d022d91f95 (diff)
downloadrneovim-bfc7bae421feb77f2eb88bf939da413f47302880.tar.gz
rneovim-bfc7bae421feb77f2eb88bf939da413f47302880.tar.bz2
rneovim-bfc7bae421feb77f2eb88bf939da413f47302880.zip
fix(health): improve version check for nightly builds #38147
Problem: nightly builds were always compared against HEAD, causing false outdated warnings. Solution: fetch both HEAD and refs/tags/nightly, match local commit against HEAD first, fall back to nightly if no match. Fix #38141
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/health/health.lua29
1 files changed, 23 insertions, 6 deletions
diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua
index 640bfaddca..8f57de4615 100644
--- a/runtime/lua/vim/health/health.lua
+++ b/runtime/lua/vim/health/health.lua
@@ -573,20 +573,37 @@ end
local function check_head_hash(commit)
local result = vim
.system(
- { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD' },
+ { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD', 'refs/tags/nightly' },
{ text = true, timeout = 5000 }
)
:wait()
if result.code ~= 0 or not result.stdout or result.stdout == '' then
return
end
- local upstream = assert(result.stdout:match('^(%x+)'))
- if not vim.startswith(upstream, commit) then
+
+ local refs = {} ---@type table<string, string>
+ for line in result.stdout:gmatch('[^\n]+') do
+ local sha, ref = line:match('^(%x+)%s+(%S+)$')
+ if sha and ref then
+ refs[ref] = sha
+ end
+ end
+
+ local head_sha = assert(refs['HEAD'])
+ local nightly_sha = refs['refs/tags/nightly']
+
+ if vim.startswith(head_sha, commit) then
+ vim.health.ok('Up to date (HEAD)')
+ elseif nightly_sha and vim.startswith(nightly_sha, commit) then
+ vim.health.ok('Up to date (nightly)')
+ else
vim.health.warn(
- ('Build is outdated. Local: %s, Latest: %s'):format(commit, upstream:sub(1, 12))
+ ('Build is outdated. Local: %s, HEAD: %s%s'):format(
+ commit,
+ head_sha:sub(1, 12),
+ nightly_sha and (', Nightly: ' .. nightly_sha:sub(1, 12)) or ''
+ )
)
- else
- vim.health.ok(('Using latest HEAD: %s'):format(upstream:sub(1, 12)))
end
end