1

Refresh generated nvim config

This commit is contained in:
2024-06-03 21:11:20 +02:00
parent fd506d4921
commit 50723ef645
2114 changed files with 84528 additions and 44473 deletions

View File

@ -93,12 +93,9 @@ Note functions with the {async} attribute are run asynchronously and accept
an optional {callback} argument.
setup({cfg}, {callback?}) *gitsigns.setup()*
setup({cfg}) *gitsigns.setup()*
Setup and start Gitsigns.
Attributes: ~
{async}
Parameters: ~
{cfg} (table|nil): Configuration for Gitsigns.
See |gitsigns-usage| for more details.

View File

@ -93,12 +93,9 @@ Note functions with the {async} attribute are run asynchronously and accept
an optional {callback} argument.
setup({cfg}, {callback?}) *gitsigns.setup()*
setup({cfg}) *gitsigns.setup()*
Setup and start Gitsigns.
Attributes: ~
{async}
Parameters: ~
{cfg} (table|nil): Configuration for Gitsigns.
See |gitsigns-usage| for more details.

View File

@ -1,6 +1,6 @@
rock_manifest = {
doc = {
["gitsigns.txt"] = "b9579713a56199f1374b4e1b12578f42"
["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885"
},
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
lua = {
@ -25,9 +25,9 @@ rock_manifest = {
["diff_int.lua"] = "df447e56f11906998e81d5b94499e013",
["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7",
git = {
["version.lua"] = "ab78b8d8a84dd92655e4847223362923"
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
},
["git.lua"] = "082cec98968b0eca1f97f54cbd4ad880",
["git.lua"] = "89ec79605c259e73ce8c19deb5b63194",
["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80",
["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9",
["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b",
@ -44,6 +44,6 @@ rock_manifest = {
["util.lua"] = "e4c4d677e3ad296adee833318a5c5845",
["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa"
},
["gitsigns.lua"] = "f423758eba3dfcca59f5a0710b58463f"
["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1"
}
}

View File

@ -12,10 +12,31 @@ local M = {}
local cwd_watcher ---@type uv.uv_fs_event_t?
--- @async
local function update_cwd_head()
if not uv.cwd() then
--- @return string gitdir
--- @return string head
local function get_gitdir_and_head()
local cwd = assert(uv.cwd())
-- Look in the cache first
for _, bcache in pairs(require('gitsigns.cache').cache) do
local repo = bcache.git_obj.repo
if repo.toplevel == cwd then
return repo.gitdir, repo.abbrev_head
end
end
local info = require('gitsigns.git').get_repo_info(cwd)
return info.gitdir, info.abbrev_head
end
local update_cwd_head = async.create(function()
local cwd = uv.cwd()
if not cwd then
return
end
local paths = vim.fs.find('.git', {
limit = 1,
upward = true,
@ -26,36 +47,7 @@ local function update_cwd_head()
return
end
if cwd_watcher then
cwd_watcher:stop()
else
cwd_watcher = assert(uv.new_fs_event())
end
local cwd = assert(uv.cwd())
--- @type string, string
local gitdir, head
local gs_cache = require('gitsigns.cache')
-- Look in the cache first
for _, bcache in pairs(gs_cache.cache) do
local repo = bcache.git_obj.repo
if repo.toplevel == cwd then
head = repo.abbrev_head
gitdir = repo.gitdir
break
end
end
local git = require('gitsigns.git')
if not head or not gitdir then
local info = git.get_repo_info(cwd)
gitdir = info.gitdir
head = info.abbrev_head
end
local gitdir, head = get_gitdir_and_head()
async.scheduler()
api.nvim_exec_autocmds('User', {
@ -71,6 +63,12 @@ local function update_cwd_head()
local towatch = gitdir .. '/HEAD'
if cwd_watcher then
cwd_watcher:stop()
else
cwd_watcher = assert(uv.new_fs_event())
end
if cwd_watcher:getpath() == towatch then
-- Already watching
return
@ -81,6 +79,7 @@ local function update_cwd_head()
local update_head = debounce_trailing(
100,
async.create(function()
local git = require('gitsigns.git')
local new_head = git.get_repo_info(cwd).abbrev_head
async.scheduler()
vim.g.gitsigns_head = new_head
@ -102,7 +101,7 @@ local function update_cwd_head()
update_head()
end)
)
end
end)
local function setup_cli()
api.nvim_create_user_command('Gitsigns', function(params)
@ -128,8 +127,6 @@ local function setup_attach()
return
end
async.scheduler()
local attach_autocmd_disabled = false
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'BufWritePost' }, {
@ -165,13 +162,11 @@ local function setup_attach()
end
end
--- @async
local function setup_cwd_head()
async.scheduler()
update_cwd_head()
local debounce = require('gitsigns.debounce').debounce_trailing
local update_cwd_head_debounced = debounce(100, async.create(update_cwd_head))
local update_cwd_head_debounced = debounce(100, update_cwd_head)
update_cwd_head_debounced()
-- Need to debounce in case some plugin changes the cwd too often
-- (like vim-grepper)
@ -185,12 +180,9 @@ end
--- Setup and start Gitsigns.
---
--- Attributes: ~
--- {async}
---
--- @param cfg table|nil Configuration for Gitsigns.
--- See |gitsigns-usage| for more details.
M.setup = async.create(1, function(cfg)
function M.setup(cfg)
gs_config.build(cfg)
if vim.fn.executable('git') == 0 then
@ -200,16 +192,12 @@ M.setup = async.create(1, function(cfg)
api.nvim_create_augroup('gitsigns', {})
if vim.fn.has('nvim-0.9') == 0 then
require('gitsigns.git.version').check()
end
setup_debug()
setup_cli()
require('gitsigns.highlight').setup()
setup_attach()
setup_cwd_head()
end)
end
return setmetatable(M, {
__index = function(_, f)

View File

@ -518,7 +518,12 @@ function Obj:file_info_tree(file, silent)
return {}
end
local info, relpath = unpack(vim.split(results[1], '\t'))
local info_line = results[1]
if not info_line then
return {}
end
local info, relpath = unpack(vim.split(info_line, '\t'))
local mode_bits, objtype, object_name = unpack(vim.split(info, '%s+'))
assert(objtype == 'blob')

View File

@ -34,6 +34,7 @@ local function parse_version(version)
return ret
end
--- @async
local function set_version()
local version = gs_config.config._git_version
if version ~= 'auto' then
@ -70,6 +71,7 @@ local function set_version()
M.version = parse_version(parts[3])
end
--- @async
--- Usage: check_version{2,3}
--- @param version {[1]: integer, [2]:integer, [3]:integer}?
--- @return boolean

View File

@ -1,6 +1,6 @@
rock_manifest = {
doc = {
["gitsigns.txt"] = "b9579713a56199f1374b4e1b12578f42"
["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885"
},
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
lua = {
@ -25,9 +25,9 @@ rock_manifest = {
["diff_int.lua"] = "df447e56f11906998e81d5b94499e013",
["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7",
git = {
["version.lua"] = "ab78b8d8a84dd92655e4847223362923"
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
},
["git.lua"] = "082cec98968b0eca1f97f54cbd4ad880",
["git.lua"] = "89ec79605c259e73ce8c19deb5b63194",
["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80",
["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9",
["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b",
@ -44,6 +44,6 @@ rock_manifest = {
["util.lua"] = "e4c4d677e3ad296adee833318a5c5845",
["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa"
},
["gitsigns.lua"] = "f423758eba3dfcca59f5a0710b58463f"
["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1"
}
}