only pull and add

This commit is contained in:
Paul Liverman III 2018-03-01 19:42:36 -08:00
parent 380708bae6
commit 4e92faf3ab
3 changed files with 9 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
*.lua *.lua
!push.lua
!pull.lua !pull.lua
!add.lua !add.lua

View File

@ -28,19 +28,18 @@ for line in list:gmatch("[^\n]+") do
end end
for _index_0 = 1, #config do for _index_0 = 1, #config do
local item = config[_index_0] local item = config[_index_0]
if item.remote and item.remote.push then if item.remote and item.remote.fetch then
if "boolean" == type(item.remote.push) then
item.remote.push = item.remote.fetch
end
if not (item.remote.branch) then if not (item.remote.branch) then
item.remote.branch = "master" item.remote.branch = "master"
end end
if item.remote.name then if item.remote.name then
if not (remotes[item.remote.name]) then if not (remotes[item.remote.name]) then
execute("git remote add -f " .. tostring(item.remote.name) .. " " .. tostring(item.remote.fetch)) execute("git remote add -f " .. tostring(item.remote.name) .. " " .. tostring(item.remote.fetch))
execute("git remote set-url --push " .. tostring(item.remote.name) .. " " .. tostring(item.remote.push)) 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 end
end end
execute("git subtree push --prefix " .. tostring(item.path:gsub("%.", "/")) .. " " .. tostring(item.remote.push) .. " " .. tostring(item.remote.branch)) execute("git subtree add --prefix " .. tostring(item.path:gsub("%.", "/")) .. " " .. tostring(item.remote.fetch) .. " " .. tostring(item.remote.branch) .. " --squash")
end end
end end

View File

@ -24,16 +24,15 @@ for line in list\gmatch "[^\n]+"
remotes[line] = true remotes[line] = true
for item in *config for item in *config
if item.remote and item.remote.push -- if configured to push if item.remote and item.remote.fetch -- if configured to pull
if "boolean" == type item.remote.push
item.remote.push = item.remote.fetch
unless item.remote.branch unless item.remote.branch
item.remote.branch = "master" item.remote.branch = "master"
if item.remote.name -- if we want a named remote if item.remote.name -- if we want a named remote
unless remotes[item.remote.name] -- add it if needed unless remotes[item.remote.name] -- add it if needed
execute "git remote add -f #{item.remote.name} #{item.remote.fetch}" execute "git remote add -f #{item.remote.name} #{item.remote.fetch}"
execute "git remote set-url --push #{item.remote.name} #{item.remote.push}" 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.. -- 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"