1 | var u = require('./util')
|
2 |
|
3 | exports.help = `
|
4 | Usage: git ssb fork [<upstream>] <remote_name>
|
5 |
|
6 | Create a new git-ssb repo as a fork of another repo
|
7 | and add it as a git remote
|
8 |
|
9 | Arguments:
|
10 | upstream id, url, or git remote name of the repo to fork.
|
11 | default: 'origin' or 'ssb'
|
12 | remote_name Name for the new remote
|
13 | `
|
14 |
|
15 | exports.fn = function (argv) {
|
16 | if (argv._.length < 1 || argv._.length > 2) return u.help('fork')
|
17 |
|
18 | var repo
|
19 | if (argv._.length == 1) repo = u.getRemote()
|
20 | else if (argv._.length == 2) repo = u.getRemote(argv._.shift())
|
21 | if (!repo) throw 'unable to find git-ssb upstream repo'
|
22 | var name = argv._[0]
|
23 | if (!name) throw 'missing remote name'
|
24 | require('./create').createRepo(argv, name, null, repo)
|
25 | }
|