diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-01-25 19:03:32 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-02-03 11:12:48 +0100 |
commit | e1ae8c6a71e253f4311c45a6be5b2d93587d2755 (patch) | |
tree | 3935ef75d83a0f26c1ec09679a9afe716a547696 /git-tools | |
parent | 8eee36dc0f6111c3a4a6a50d0e33833f19430a0e (diff) | |
download | forums-e1ae8c6a71e253f4311c45a6be5b2d93587d2755.tar forums-e1ae8c6a71e253f4311c45a6be5b2d93587d2755.tar.gz forums-e1ae8c6a71e253f4311c45a6be5b2d93587d2755.tar.bz2 forums-e1ae8c6a71e253f4311c45a6be5b2d93587d2755.tar.xz forums-e1ae8c6a71e253f4311c45a6be5b2d93587d2755.zip |
[ticket/9805] Better support for already existing repositories.
PHPBB3-9805
Diffstat (limited to 'git-tools')
-rw-r--r-- | git-tools/setup_github_network.php | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index 04187aaa4a..f34787c4c4 100644 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -12,12 +12,6 @@ if ($argc < 2) show_usage(); } -if (file_exists('.git')) -{ - echo "[error] git repository already exists\n"; - exit(1); -} - function show_usage() { $filename = basename(__FILE__); @@ -58,9 +52,6 @@ run(null, $dry_run); $network = get_network($username, $repository); $collaborators = get_collaborators($username, $repository); -// Clone the blessed repository -clone_repository($username, $repository, isset($collaborators[$developer])); - switch ($scope) { case 'collaborators': @@ -83,14 +74,20 @@ switch ($scope) show_usage(); } -foreach ($remotes as $remote) +if (file_exists('.git')) { - if ($remote['username'] == $username) - { - // Skip blessed repository. - continue; - } + add_remote($username, $repository, isset($collaborators[$developer])); +} +else +{ + clone_repository($username, $repository, isset($collaborators[$developer])); +} +// Skip blessed repository. +unset($remotes[$username]); + +foreach ($remotes as $remote) +{ add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer); } @@ -99,12 +96,12 @@ run('git remote update'); function clone_repository($username, $repository, $pushable = false) { $url = get_repository_url($username, $repository, false); - run("git clone $url ./"); + run("git clone $url ./ --origin $username"); if ($pushable) { $ssh_url = get_repository_url($username, $repository, true); - run("git remote set-url --push origin $ssh_url"); + run("git remote set-url --push $username $ssh_url"); } } |