ensure-git-remote ( owner repo -- )


Vocabulary
git

Inputs
owneran object
repoan object


Outputs
None

Definition


: ensure-git-remote ( owner repo -- )
[ parse-git-config ] 2dip 3dup has-remote-repo?
[ 3drop ] [
[
pick has-any-git-at-urls? [
[ "git@github.com:%s/%s" sprintf ] [
drop
"+refs/heads/*:refs/remotes/%s/*" sprintf
] 2bi [
[ ~quotation~ ] dip [ ] curry compose
{ } like
] dip [ [ "fetch" ] ] dip [ ] curry compose
{ } like [ ] 2curry { } like >hashtable
] [
[ "https://github.com/%s/%s" sprintf ] [
drop
"+refs/heads/*:refs/remotes/%s/*" sprintf
] 2bi [
[ ~quotation~ ] dip [ ] curry compose
{ } like
] dip [ [ "fetch" ] ] dip [ ] curry compose
{ } like [ ] 2curry { } like >hashtable
] if
] 2keep "_" glue "\"" dup surround "remote " prepend
swap 2array suffix write-git-config
] if ;