fix: stylua
This commit is contained in:
parent
176ff6a833
commit
bd0f4d518d
|
@ -47,14 +47,14 @@ local function complete_heads(arglead)
|
|||
--- @type string[]
|
||||
local all =
|
||||
vim.fn.systemlist({ 'git', 'rev-parse', '--symbolic', '--branches', '--tags', '--remotes' })
|
||||
return vim.tbl_filter(
|
||||
--- @param x string
|
||||
--- @return boolean
|
||||
function(x)
|
||||
return vim.startswith(x, arglead)
|
||||
end,
|
||||
all
|
||||
)
|
||||
return vim.tbl_filter(
|
||||
--- @param x string
|
||||
--- @return boolean
|
||||
function(x)
|
||||
return vim.startswith(x, arglead)
|
||||
end,
|
||||
all
|
||||
)
|
||||
end
|
||||
|
||||
--- Toggle |gitsigns-config-signbooleancolumn|
|
||||
|
@ -447,7 +447,7 @@ end)
|
|||
--- @param word string
|
||||
--- @return boolean
|
||||
local function findword(x, word)
|
||||
return string.find(x, '%f[%w_]'..word..'%f[^%w_]') ~= nil
|
||||
return string.find(x, '%f[%w_]' .. word .. '%f[^%w_]') ~= nil
|
||||
end
|
||||
|
||||
--- @param opts? Gitsigns.NavOpts
|
||||
|
@ -1261,7 +1261,7 @@ M.get_actions = function()
|
|||
'stage_hunk',
|
||||
'reset_hunk',
|
||||
'preview_hunk',
|
||||
'select_hunk'
|
||||
'select_hunk',
|
||||
})
|
||||
else
|
||||
actions_l[#actions_l + 1] = 'blame_line'
|
||||
|
@ -1279,7 +1279,9 @@ M.get_actions = function()
|
|||
return actions
|
||||
end
|
||||
|
||||
for name, f in pairs(M --[[@as table<string,function>]]) do
|
||||
for name, f in
|
||||
pairs(M --[[@as table<string,function>]])
|
||||
do
|
||||
if vim.startswith(name, 'toggle') then
|
||||
C[name] = function(args)
|
||||
f(args[1])
|
||||
|
|
|
@ -110,7 +110,7 @@ M.config = setmetatable({}, {
|
|||
end
|
||||
end
|
||||
return rawget(t, k)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--- @type table<string,Gitsigns.SchemaElem>
|
||||
|
@ -442,15 +442,15 @@ M.schema = {
|
|||
count_chars = {
|
||||
type = 'table',
|
||||
default = {
|
||||
[1] = '1', -- '₁',
|
||||
[2] = '2', -- '₂',
|
||||
[3] = '3', -- '₃',
|
||||
[4] = '4', -- '₄',
|
||||
[5] = '5', -- '₅',
|
||||
[6] = '6', -- '₆',
|
||||
[7] = '7', -- '₇',
|
||||
[8] = '8', -- '₈',
|
||||
[9] = '9', -- '₉',
|
||||
[1] = '1', -- '₁',
|
||||
[2] = '2', -- '₂',
|
||||
[3] = '3', -- '₃',
|
||||
[4] = '4', -- '₄',
|
||||
[5] = '5', -- '₅',
|
||||
[6] = '6', -- '₆',
|
||||
[7] = '7', -- '₇',
|
||||
[8] = '8', -- '₈',
|
||||
[9] = '9', -- '₉',
|
||||
['+'] = '>', -- '₊',
|
||||
},
|
||||
description = [[
|
||||
|
@ -722,7 +722,7 @@ M.schema = {
|
|||
},
|
||||
|
||||
_test_mode = {
|
||||
description = "Enable test mode",
|
||||
description = 'Enable test mode',
|
||||
type = 'boolean',
|
||||
default = false,
|
||||
},
|
||||
|
|
|
@ -121,11 +121,7 @@ local function get_blame_virt_text(bufnr, blame_info)
|
|||
clb_formatter = default_formatter(clb_formatter)
|
||||
end
|
||||
|
||||
return clb_formatter(
|
||||
git_obj.repo.username,
|
||||
blame_info,
|
||||
config.current_line_blame_formatter_opts
|
||||
)
|
||||
return clb_formatter(git_obj.repo.username, blame_info, config.current_line_blame_formatter_opts)
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
|
|
|
@ -311,7 +311,7 @@ function M.get_repo_info(path, cmd, gitdir, toplevel)
|
|||
toplevel = toplevel_r,
|
||||
gitdir = gitdir_r,
|
||||
abbrev_head = process_abbrev_head(gitdir_r, results[3], path, cmd),
|
||||
detached = toplevel_r and gitdir_r ~= toplevel_r .. '/.git'
|
||||
detached = toplevel_r and gitdir_r ~= toplevel_r .. '/.git',
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -623,10 +623,10 @@ function Obj:run_blame(lines, lnum, ignore_whitespace)
|
|||
local args = { 'blame', '--contents', '-', '--incremental' }
|
||||
|
||||
if lnum then
|
||||
vim.list_extend(args, { '-L', lnum..',+1' })
|
||||
vim.list_extend(args, { '-L', lnum .. ',+1' })
|
||||
end
|
||||
|
||||
args[#args+1] = self.file
|
||||
args[#args + 1] = self.file
|
||||
|
||||
if ignore_whitespace then
|
||||
args[#args + 1] = '-w'
|
||||
|
@ -639,7 +639,7 @@ function Obj:run_blame(lines, lnum, ignore_whitespace)
|
|||
|
||||
local results, stderr = self:command(args, { writer = lines, suppress_stderr = true })
|
||||
if stderr then
|
||||
error_once('Error running git-blame: '.. stderr)
|
||||
error_once('Error running git-blame: ' .. stderr)
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -702,7 +702,10 @@ function Obj:run_blame(lines, lnum, ignore_whitespace)
|
|||
-- The output given by "git blame" that attributes a line to contents
|
||||
-- taken from the file specified by the "--contents" option shows it
|
||||
-- differently from a line attributed to the working tree file.
|
||||
if commit.author_mail == '<external.file>' or commit.author_mail == 'External file (--contents)' then
|
||||
if
|
||||
commit.author_mail == '<external.file>'
|
||||
or commit.author_mail == 'External file (--contents)'
|
||||
then
|
||||
commit = vim.tbl_extend('force', commit, NOT_COMMITTED)
|
||||
end
|
||||
commits[sha] = commit
|
||||
|
@ -722,7 +725,7 @@ function Obj:run_blame(lines, lnum, ignore_whitespace)
|
|||
commit = commits[sha],
|
||||
filename = filename,
|
||||
previous_filename = previous_filename,
|
||||
previous_sha = previous_filename
|
||||
previous_sha = previous_filename,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,35 +60,39 @@ local function handle_moved(bufnr, old_relpath)
|
|||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
local handler = debounce_trailing(200, async.void(function(bufnr)
|
||||
local __FUNC__ = 'watcher_handler'
|
||||
buf_check(bufnr)
|
||||
|
||||
local git_obj = cache[bufnr].git_obj
|
||||
|
||||
git_obj.repo:update_abbrev_head()
|
||||
|
||||
buf_check(bufnr)
|
||||
|
||||
Status:update(bufnr, { head = git_obj.repo.abbrev_head })
|
||||
|
||||
local was_tracked = git_obj.object_name ~= nil
|
||||
local old_relpath = git_obj.relpath
|
||||
|
||||
git_obj:update_file_info()
|
||||
buf_check(bufnr)
|
||||
|
||||
if config.watch_gitdir.follow_files and was_tracked and not git_obj.object_name then
|
||||
-- File was tracked but is no longer tracked. Must of been removed or
|
||||
-- moved. Check if it was moved and switch to it.
|
||||
handle_moved(bufnr, old_relpath)
|
||||
local handler = debounce_trailing(
|
||||
200,
|
||||
async.void(function(bufnr)
|
||||
local __FUNC__ = 'watcher_handler'
|
||||
buf_check(bufnr)
|
||||
end
|
||||
|
||||
cache[bufnr]:invalidate()
|
||||
local git_obj = cache[bufnr].git_obj
|
||||
|
||||
require('gitsigns.manager').update(bufnr)
|
||||
end), 1)
|
||||
git_obj.repo:update_abbrev_head()
|
||||
|
||||
buf_check(bufnr)
|
||||
|
||||
Status:update(bufnr, { head = git_obj.repo.abbrev_head })
|
||||
|
||||
local was_tracked = git_obj.object_name ~= nil
|
||||
local old_relpath = git_obj.relpath
|
||||
|
||||
git_obj:update_file_info()
|
||||
buf_check(bufnr)
|
||||
|
||||
if config.watch_gitdir.follow_files and was_tracked and not git_obj.object_name then
|
||||
-- File was tracked but is no longer tracked. Must of been removed or
|
||||
-- moved. Check if it was moved and switch to it.
|
||||
handle_moved(bufnr, old_relpath)
|
||||
buf_check(bufnr)
|
||||
end
|
||||
|
||||
cache[bufnr]:invalidate()
|
||||
|
||||
require('gitsigns.manager').update(bufnr)
|
||||
end),
|
||||
1
|
||||
)
|
||||
|
||||
-- vim.inspect but on one line
|
||||
--- @param x any
|
||||
|
@ -101,7 +105,7 @@ local M = {}
|
|||
|
||||
local WATCH_IGNORE = {
|
||||
ORIG_HEAD = true,
|
||||
FETCH_HEAD = true
|
||||
FETCH_HEAD = true,
|
||||
}
|
||||
|
||||
--- @param bufnr integer
|
||||
|
|
Loading…
Reference in New Issue