Skip to content

Commit 93f6eb5

Browse files
committed
rename field to _branch
1 parent 6533699 commit 93f6eb5

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

lua/strive/init.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ function Plugin.new(spec)
598598
is_local = spec.is_local or false, -- Development mode flag
599599
is_lazy = spec.is_lazy or false, -- Whether to lazy load
600600
local_path = nil, -- Local path to load
601-
branch = spec.branch, -- Git branch to use
601+
remote_branch = spec._branch, -- Git branch to use
602602

603603
-- States
604604
status = STATUS.PENDING, -- Current plugin status
@@ -1005,7 +1005,7 @@ function Plugin:branch(branch_name)
10051005
type(branch_name) == 'string' and branch_name ~= '',
10061006
'Branch name must be a non-empty string'
10071007
)
1008-
self.branch = branch_name
1008+
self._branch = branch_name
10091009
return self
10101010
end
10111011

@@ -1085,9 +1085,9 @@ function Plugin:install()
10851085
}
10861086

10871087
-- Add branch specification if provided
1088-
if self.branch then
1089-
table.insert(cmd, '--branch=' .. self.branch)
1090-
M.log('debug', string.format('Installing %s from branch: %s', self.name, self.branch))
1088+
if self._branch then
1089+
table.insert(cmd, '--branch=' .. self._branch)
1090+
M.log('debug', string.format('Installing %s from branch: %s', self.name, self._branch))
10911091
end
10921092

10931093
-- Add URL and path at the end
@@ -1096,7 +1096,7 @@ function Plugin:install()
10961096

10971097
-- Update status
10981098
self.status = STATUS.INSTALLING
1099-
local install_msg = self.branch and ('Installing from branch: ' .. self.branch)
1099+
local install_msg = self._branch and ('Installing from branch: ' .. self._branch)
11001100
or 'Starting installation...'
11011101
ui:update_entry(self.name, self.status, install_msg)
11021102

@@ -1120,7 +1120,7 @@ function Plugin:install()
11201120

11211121
if result.success then
11221122
self.status = STATUS.INSTALLED
1123-
local success_msg = self.branch and ('Installed from branch: ' .. self.branch)
1123+
local success_msg = self._branch and ('Installed from branch: ' .. self._branch)
11241124
or 'Installation complete'
11251125
ui:update_entry(self.name, self.status, success_msg)
11261126

@@ -1164,8 +1164,8 @@ function Plugin:has_updates()
11641164
}
11651165

11661166
-- If a specific branch is set, fetch that branch
1167-
if self.branch then
1168-
table.insert(fetch_cmd, self.branch .. ':refs/remotes/origin/' .. self.branch)
1167+
if self._branch then
1168+
table.insert(fetch_cmd, self._branch .. ':refs/remotes/origin/' .. self._branch)
11691169
end
11701170

11711171
local result = Async.try_await(Async.system(fetch_cmd))
@@ -1175,7 +1175,7 @@ function Plugin:has_updates()
11751175
end
11761176

11771177
-- Compare with the appropriate upstream
1178-
local upstream_ref = self.branch and '@{upstream}' or '@{upstream}'
1178+
local upstream_ref = self._branch and '@{upstream}' or '@{upstream}'
11791179
local rev_cmd = {
11801180
'git',
11811181
'-C',
@@ -1249,7 +1249,7 @@ function Plugin:update(skip_check)
12491249

12501250
if not has_updates then
12511251
self.status = STATUS.UPDATED
1252-
local up_to_date_msg = self.branch and ('Up to date on branch: ' .. self.branch)
1252+
local up_to_date_msg = self._branch and ('Up to date on branch: ' .. self._branch)
12531253
or 'Already up to date'
12541254
ui:update_entry(self.name, self.status, up_to_date_msg)
12551255
callback(true, 'up_to_date')
@@ -1259,17 +1259,17 @@ function Plugin:update(skip_check)
12591259

12601260
-- Update the plugin
12611261
self.status = STATUS.UPDATING
1262-
local updating_msg = self.branch and ('Updating branch: ' .. self.branch)
1262+
local updating_msg = self._branch and ('Updating branch: ' .. self._branch)
12631263
or 'Starting update...'
12641264
ui:update_entry(self.name, self.status, updating_msg)
12651265

12661266
local path = self:get_path()
12671267
local cmd = { 'git', '-C', path, 'pull', '--progress' }
12681268

12691269
-- If specific branch is set, pull from that branch
1270-
if self.branch then
1270+
if self._branch then
12711271
table.insert(cmd, 'origin')
1272-
table.insert(cmd, self.branch)
1272+
table.insert(cmd, self._branch)
12731273
end
12741274

12751275
-- Use our new Async.system wrapper
@@ -1298,13 +1298,13 @@ function Plugin:update(skip_check)
12981298
local commit_info = stdout:match('([a-f0-9]+)%.%.([a-f0-9]+)')
12991299

13001300
if stdout:find('Already up to date') then
1301-
update_info = self.branch and ('Already up to date on branch: ' .. self.branch)
1301+
update_info = self._branch and ('Already up to date on branch: ' .. self._branch)
13021302
or 'Already up to date'
13031303
elseif commit_info then
1304-
local branch_info = self.branch and (' on branch: ' .. self.branch) or ''
1304+
local branch_info = self._branch and (' on branch: ' .. self._branch) or ''
13051305
update_info = string.format('Updated to %s%s', commit_info, branch_info)
1306-
elseif self.branch then
1307-
update_info = 'Updated on branch: ' .. self.branch
1306+
elseif self._branch then
1307+
update_info = 'Updated on branch: ' .. self._branch
13081308
end
13091309

13101310
ui:update_entry(self.name, self.status, update_info)
@@ -1335,7 +1335,7 @@ function Plugin:install_with_retry()
13351335
end
13361336

13371337
self.status = STATUS.INSTALLING
1338-
local install_msg = self.branch and ('Installing from branch: ' .. self.branch)
1338+
local install_msg = self._branch and ('Installing from branch: ' .. self._branch)
13391339
or 'Starting installation...'
13401340
ui:update_entry(self.name, self.status, install_msg)
13411341

@@ -1344,8 +1344,8 @@ function Plugin:install_with_retry()
13441344
local cmd = { 'git', 'clone', '--progress' }
13451345

13461346
-- Add branch specification if provided
1347-
if self.branch then
1348-
table.insert(cmd, '--branch=' .. self.branch)
1347+
if self._branch then
1348+
table.insert(cmd, '--branch=' .. self._branch)
13491349
end
13501350

13511351
table.insert(cmd, url)
@@ -1374,7 +1374,7 @@ function Plugin:install_with_retry()
13741374
-- Handle result
13751375
if result.success then
13761376
self.status = STATUS.INSTALLED
1377-
local success_msg = self.branch and ('Installed from branch: ' .. self.branch)
1377+
local success_msg = self._branch and ('Installed from branch: ' .. self._branch)
13781378
or 'Installation complete'
13791379
ui:update_entry(self.name, self.status, success_msg)
13801380

0 commit comments

Comments
 (0)