mirror of
https://github.com/lazuscripts/locator.git
synced 2024-11-19 10:54:24 +00:00
only pull and add
This commit is contained in:
parent
380708bae6
commit
4e92faf3ab
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
*.lua
|
||||
!push.lua
|
||||
!pull.lua
|
||||
!add.lua
|
||||
|
@ -28,19 +28,18 @@ for line in list:gmatch("[^\n]+") do
|
||||
end
|
||||
for _index_0 = 1, #config do
|
||||
local item = config[_index_0]
|
||||
if item.remote and item.remote.push then
|
||||
if "boolean" == type(item.remote.push) then
|
||||
item.remote.push = item.remote.fetch
|
||||
end
|
||||
if item.remote and item.remote.fetch then
|
||||
if not (item.remote.branch) then
|
||||
item.remote.branch = "master"
|
||||
end
|
||||
if item.remote.name then
|
||||
if not (remotes[item.remote.name]) then
|
||||
execute("git remote add -f " .. tostring(item.remote.name) .. " " .. tostring(item.remote.fetch))
|
||||
if item.remote.push and not ("boolean" == type(item.remote.push)) then
|
||||
execute("git remote set-url --push " .. tostring(item.remote.name) .. " " .. tostring(item.remote.push))
|
||||
end
|
||||
end
|
||||
execute("git subtree push --prefix " .. tostring(item.path:gsub("%.", "/")) .. " " .. tostring(item.remote.push) .. " " .. tostring(item.remote.branch))
|
||||
end
|
||||
execute("git subtree add --prefix " .. tostring(item.path:gsub("%.", "/")) .. " " .. tostring(item.remote.fetch) .. " " .. tostring(item.remote.branch) .. " --squash")
|
||||
end
|
||||
end
|
@ -24,16 +24,15 @@ for line in list\gmatch "[^\n]+"
|
||||
remotes[line] = true
|
||||
|
||||
for item in *config
|
||||
if item.remote and item.remote.push -- if configured to push
|
||||
if "boolean" == type item.remote.push
|
||||
item.remote.push = item.remote.fetch
|
||||
if item.remote and item.remote.fetch -- if configured to pull
|
||||
unless item.remote.branch
|
||||
item.remote.branch = "master"
|
||||
|
||||
if item.remote.name -- if we want a named remote
|
||||
unless remotes[item.remote.name] -- add it if needed
|
||||
execute "git remote add -f #{item.remote.name} #{item.remote.fetch}"
|
||||
if item.remote.push and not ("boolean" == type item.remote.push)
|
||||
execute "git remote set-url --push #{item.remote.name} #{item.remote.push}"
|
||||
|
||||
-- we actually ignore names with in-script usage..
|
||||
execute "git subtree push --prefix #{item.path\gsub "%.", "/"} #{item.remote.push} #{item.remote.branch}"
|
||||
execute "git subtree add --prefix #{item.path\gsub "%.", "/"} #{item.remote.fetch} #{item.remote.branch} --squash"
|
Loading…
Reference in New Issue
Block a user