Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

Commit bea5038

Browse files
committed
update
1 parent 4cb5cc0 commit bea5038

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

lua/strive/init.lua

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ local DEFAULT_SETTINGS = {
2626
auto_install = if_nil(vim.g.strive_auto_install, true),
2727
log_level = if_nil(vim.g.strive_log_level, 'warn'),
2828
git_timeout = if_nil(vim.g.strive_git_timeout, 60000),
29+
git_depth = if_nil(vim.g.strive_git_depth, 1),
2930
install_retry = if_nil(vim.g.strive_install_with_retry, false),
3031
}
3132

@@ -523,10 +524,11 @@ function ProgressWindow:refresh()
523524
end
524525
table.sort(sorted_plugins)
525526

527+
local width = api.nvim_win_get_width(self.winid)
526528
-- Header
527-
table.insert(lines, string.rep('=', 80))
529+
table.insert(lines, string.rep('=', width))
528530
table.insert(lines, string.format('%-30s %-10s %s', 'Plugin', 'Status', 'Message'))
529-
table.insert(lines, string.rep('=', 80))
531+
table.insert(lines, string.rep('=', width))
530532

531533
-- Plugin entries
532534
for _, name in ipairs(sorted_plugins) do
@@ -968,10 +970,15 @@ function Plugin:install()
968970
-- Try to install with proper error handling
969971
local path = self:get_path()
970972
local url = ('https://github.com/%s'):format(self.name)
971-
local cmd = { 'git', 'clone', '--progress', url, path }
972-
973-
-- Ensure parent directory exists
974-
-- vim.fn.mkdir(vim.fs.dirname(path), 'p')
973+
local cmd = {
974+
'git',
975+
'clone',
976+
'--depth=' .. DEFAULT_SETTINGS.git_depth,
977+
'--single-branch',
978+
'--progress',
979+
url,
980+
path,
981+
}
975982

976983
-- Update status
977984
self.status = STATUS.INSTALLING
@@ -1027,24 +1034,33 @@ function Plugin:has_updates()
10271034
callback(false)
10281035
return
10291036
end
1030-
10311037
local path = self:get_path()
1032-
local fetch_result =
1033-
Async.try_await(Async.system({ 'git', '-C', self:get_path(), 'remote', 'update' }))
1034-
if not fetch_result.success then
1035-
callback(false)
1036-
return
1037-
end
1038-
-- Check local status
1039-
local status_result = Async.try_await(Async.system({ 'git', '-C', path, 'status', '-uno' }))
1040-
if not status_result.success then
1038+
local cmd = {
1039+
'git',
1040+
'-C',
1041+
path,
1042+
'fetch',
1043+
'--dry-run',
1044+
'--quiet',
1045+
'origin',
1046+
'HEAD',
1047+
'&&',
1048+
'git',
1049+
'-C',
1050+
path,
1051+
'rev-list',
1052+
'--count',
1053+
'HEAD..@{upstream}',
1054+
}
1055+
1056+
local result = Async.try_await(Async.system(cmd))
1057+
if not result.success then
10411058
callback(false)
10421059
return
10431060
end
10441061

1045-
local stdout = status_result.value.stdout
1046-
local behind = stdout:match('behind') ~= nil
1047-
callback(behind)
1062+
local has_updates = result.value.stdout and tonumber(result.value.stdout:match('%d+')) > 0
1063+
callback(has_updates)
10481064
end)()
10491065
end
10501066

0 commit comments

Comments
 (0)