Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Merge branch 'default-repo-name'
Browse files Browse the repository at this point in the history
  • Loading branch information
cel authored and cel committed Nov 24, 2016
2 parents 284fb77 + aac361c commit 04a3aa6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var proc = require('child_process')
var u = require('./util')
var path = require('path')

function hasRemote(name) {
var remotes = proc.spawnSync('git', ['remote']).stdout.toString().split(/\n/)
Expand All @@ -15,6 +16,10 @@ module.exports = function (argv) {
module.exports.createRepo = function (config, remoteName, name, upstream) {
if (!remoteName) throw 'Missing remote name'
if (hasRemote(remoteName)) throw `Remote '${remoteName}' already exists`

// If no name is given, use the current directory's name.
if (!name) name = path.basename(process.cwd())

u.getSbot(config, function (err, sbot) {
if (err) throw err
require('ssb-git-repo').createRepo(sbot, {
Expand Down

0 comments on commit 04a3aa6

Please sign in to comment.