From e4ce0c7270e52ecaf586a0ddcee262e2f1adaabc Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 27 Nov 2025 12:12:50 +0800 Subject: [PATCH] fix(health): git check and autocmd clean #36713 Problem: Incorrect Git check and improper autocmd cleanup Solution: Add once to the autocmd and fix the Git check condition --- runtime/lua/vim/health/health.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua index 41c7ff26e3..99e5c6fb29 100644 --- a/runtime/lua/vim/health/health.lua +++ b/runtime/lua/vim/health/health.lua @@ -533,13 +533,13 @@ local function check_sysinfo() local version_for_report = nvim_version if commit_hash then version_for_report = nvim_version:gsub('%+g' .. commit_hash, ' neovim/neovim@' .. commit_hash) - local has_git = vim.fn.executable('git') == 0 + local has_git = vim.fn.executable('git') == 1 local has_curl = vim.fn.executable('curl') == 1 - local cmd = has_git and { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'nightly' } + local cmd = has_git and { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD' } or has_curl and { 'curl', '-s', - 'https://api.github.com/repos/neovim/neovim/commits/nightly', + 'https://api.github.com/repos/neovim/neovim/commits/master', '-H', 'Accept: application/vnd.github.sha', } @@ -633,6 +633,7 @@ local function check_sysinfo() '%#WarningMsg#%@v:lua.nvim_health_bugreport_open@Click to Create Bug Report on GitHub%X%*' vim.api.nvim_create_autocmd('BufDelete', { buffer = buf, + once = true, command = 'lua _G.nvim_health_bugreport_open = nil', }) end)