mirror of
https://github.com/neovim/neovim.git
synced 2025-12-12 17:42:37 +00:00
fix(health): bug-report formatting, version check #36809
Problem: Version check failed because of "equality" comparison, so a version string of "123abc" would not match "123abcdef". Solution: - Adjust verison check. - Improve bug-report formatting.
This commit is contained in:
@@ -10,7 +10,7 @@ local function system(cmd)
|
|||||||
return result.code == 0, vim.trim(('%s\n%s'):format(result.stdout, result.stderr))
|
return result.code == 0, vim.trim(('%s\n%s'):format(result.stdout, result.stderr))
|
||||||
end
|
end
|
||||||
|
|
||||||
local suggest_faq = 'https://github.com/neovim/neovim/blob/master/BUILD.md#building'
|
local suggest_faq = 'https://neovim.io/doc/build/#building'
|
||||||
|
|
||||||
local function check_runtime()
|
local function check_runtime()
|
||||||
health.start('Runtime')
|
health.start('Runtime')
|
||||||
@@ -355,7 +355,7 @@ local function check_terminal()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
health.start('terminal')
|
health.start('Terminal')
|
||||||
local cmd = { 'infocmp', '-L' }
|
local cmd = { 'infocmp', '-L' }
|
||||||
local ok, out = system(cmd)
|
local ok, out = system(cmd)
|
||||||
local kbs_entry = vim.fn.matchstr(out, 'key_backspace=[^,[:space:]]*')
|
local kbs_entry = vim.fn.matchstr(out, 'key_backspace=[^,[:space:]]*')
|
||||||
@@ -526,13 +526,12 @@ end
|
|||||||
local function check_sysinfo()
|
local function check_sysinfo()
|
||||||
vim.health.start('System Info')
|
vim.health.start('System Info')
|
||||||
|
|
||||||
-- Use :version because vim.version().build returns "Homebrew" for brew installs.
|
-- Use :version because `vim.version().build` returns "Homebrew" for brew installs.
|
||||||
local version_output = vim.api.nvim_exec2('version', { output = true }).output
|
local version_out = vim.api.nvim_exec2('version', { output = true }).output
|
||||||
local nvim_version = version_output:match('NVIM v[^\n]+') or 'unknown'
|
local nvim_version = version_out:match('NVIM (v[^\n]+)') or 'unknown'
|
||||||
local commit_hash = nvim_version:match('%+g?(%x+)')
|
local commit --[[@type string]] = (version_out:match('%+g(%x+)') or ''):sub(1, 12)
|
||||||
local version_for_report = nvim_version
|
|
||||||
if commit_hash then
|
if vim.trim(commit) ~= '' then
|
||||||
version_for_report = nvim_version:gsub('%+g' .. commit_hash, ' neovim/neovim@' .. commit_hash)
|
|
||||||
local has_git = vim.fn.executable('git') == 1
|
local has_git = vim.fn.executable('git') == 1
|
||||||
local has_curl = vim.fn.executable('curl') == 1
|
local has_curl = vim.fn.executable('curl') == 1
|
||||||
local cmd = has_git and { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD' }
|
local cmd = has_git and { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD' }
|
||||||
@@ -548,12 +547,13 @@ local function check_sysinfo()
|
|||||||
if cmd then
|
if cmd then
|
||||||
local result = vim.system(cmd, { text = true }):wait()
|
local result = vim.system(cmd, { text = true }):wait()
|
||||||
if result.code == 0 then
|
if result.code == 0 then
|
||||||
local sha = has_git and result.stdout:match('^(%x+)') or result.stdout
|
local upstream = assert(result.stdout:match('^(%x+)') or result.stdout)
|
||||||
local latest_commit = sha and sha:sub(1, 10)
|
if not upstream:find(commit) then
|
||||||
if latest_commit and commit_hash ~= latest_commit then
|
|
||||||
vim.health.warn(
|
vim.health.warn(
|
||||||
string.format('Build is outdated. Local: %s, Latest: %s', commit_hash, latest_commit)
|
('Build is outdated. Local: %s, Latest: %s'):format(commit, upstream:sub(1, 12))
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
vim.health.ok(('Using latest HEAD: %s'):format(upstream:sub(1, 12)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -566,7 +566,7 @@ local function check_sysinfo()
|
|||||||
local terminal = detect_terminal()
|
local terminal = detect_terminal()
|
||||||
local term_env = vim.env.TERM or 'unknown'
|
local term_env = vim.env.TERM or 'unknown'
|
||||||
|
|
||||||
vim.health.info('Nvim version: ' .. nvim_version)
|
vim.health.info(('Nvim version: `%s` %s'):format(nvim_version, commit))
|
||||||
vim.health.info('Operating system: ' .. os_string)
|
vim.health.info('Operating system: ' .. os_string)
|
||||||
vim.health.info('Terminal: ' .. terminal)
|
vim.health.info('Terminal: ' .. terminal)
|
||||||
vim.health.info('$TERM: ' .. term_env)
|
vim.health.info('$TERM: ' .. term_env)
|
||||||
@@ -575,43 +575,28 @@ local function check_sysinfo()
|
|||||||
0,
|
0,
|
||||||
string.format(
|
string.format(
|
||||||
[[
|
[[
|
||||||
## Problem:
|
## Problem
|
||||||
|
|
||||||
|
## Steps to reproduce
|
||||||
|
|
||||||
|
|
||||||
## Steps to reproduce:
|
|
||||||
```
|
```
|
||||||
nvim --clean
|
nvim --clean
|
||||||
```
|
```
|
||||||
|
|
||||||
## Expected behavior:
|
## Expected behavior
|
||||||
|
|
||||||
|
## System info
|
||||||
|
|
||||||
|
- Nvim version (nvim -v): `%s` neovim/neovim@%s
|
||||||
## Nvim version (nvim -v):
|
- Vim (not Nvim) behaves the same?: ?
|
||||||
|
- Operating system/version: %s
|
||||||
%s
|
- Terminal name/version: %s
|
||||||
|
- $TERM environment variable: `%s`
|
||||||
## Vim (not Nvim) behaves the same?
|
- Installation: ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Operating system/version:
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
## Terminal name/version:
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
## $TERM environment variable:
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
## Installation:
|
|
||||||
|
|
||||||
]],
|
]],
|
||||||
version_for_report,
|
nvim_version,
|
||||||
|
commit,
|
||||||
os_string,
|
os_string,
|
||||||
terminal,
|
terminal,
|
||||||
term_env
|
term_env
|
||||||
|
|||||||
Reference in New Issue
Block a user