Skip to content

Commit 378d4bf

Browse files
committed
update
1 parent bea5038 commit 378d4bf

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

lua/strive/init.lua

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ function TaskQueue:status()
377377
}
378378
end
379379

380-
local task_queue = TaskQueue.new(DEFAULT_SETTINGS.max_concurrent_tasks)
381380
-- =====================================================================
382381
-- 4. UI Window
383382
-- =====================================================================
@@ -457,6 +456,7 @@ function ProgressWindow:open()
457456
title = self.title,
458457
title_pos = 'center',
459458
})
459+
self.ns = api.nvim_create_namespace('Strive')
460460

461461
-- Set window options
462462
vim.wo[self.winid].wrap = false
@@ -529,7 +529,6 @@ function ProgressWindow:refresh()
529529
table.insert(lines, string.rep('=', width))
530530
table.insert(lines, string.format('%-30s %-10s %s', 'Plugin', 'Status', 'Message'))
531531
table.insert(lines, string.rep('=', width))
532-
533532
-- Plugin entries
534533
for _, name in ipairs(sorted_plugins) do
535534
local entry = self.entries[name]
@@ -544,6 +543,7 @@ function ProgressWindow:refresh()
544543
api.nvim_buf_set_lines(self.bufnr, 0, -1, false, lines)
545544
vim.bo[self.bufnr].modifiable = false
546545

546+
vim.hl.range(self.bufnr, self.ns, 'Comment', { 0, 0 }, { 2, -1 })
547547
return self
548548
end
549549

@@ -1034,17 +1034,24 @@ function Plugin:has_updates()
10341034
callback(false)
10351035
return
10361036
end
1037+
10371038
local path = self:get_path()
1038-
local cmd = {
1039+
local fetch_cmd = {
10391040
'git',
10401041
'-C',
10411042
path,
10421043
'fetch',
1043-
'--dry-run',
10441044
'--quiet',
10451045
'origin',
1046-
'HEAD',
1047-
'&&',
1046+
}
1047+
1048+
local result = Async.try_await(Async.system(fetch_cmd))
1049+
if not result.success then
1050+
callback(false)
1051+
return
1052+
end
1053+
1054+
local rev_cmd = {
10481055
'git',
10491056
'-C',
10501057
path,
@@ -1053,13 +1060,15 @@ function Plugin:has_updates()
10531060
'HEAD..@{upstream}',
10541061
}
10551062

1056-
local result = Async.try_await(Async.system(cmd))
1063+
result = Async.try_await(Async.system(rev_cmd))
10571064
if not result.success then
10581065
callback(false)
10591066
return
10601067
end
10611068

1062-
local has_updates = result.value.stdout and tonumber(result.value.stdout:match('%d+')) > 0
1069+
local count = tonumber(result.value.stdout and result.value.stdout:match('%d+') or '0')
1070+
local has_updates = count and count > 0
1071+
10631072
callback(has_updates)
10641073
end)()
10651074
end
@@ -1304,6 +1313,8 @@ function M.install()
13041313
M.log('info', string.format('Installing %d plugins...', #plugins_to_install))
13051314
ui:open()
13061315

1316+
local task_queue = TaskQueue.new(DEFAULT_SETTINGS.max_concurrent_tasks)
1317+
13071318
-- Create installation tasks with proper error handling
13081319
local install_tasks = {}
13091320
for _, plugin in ipairs(plugins_to_install) do

0 commit comments

Comments
 (0)