From 014d6189fcc3ca81c3139acd4806387140c73678 Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Fri, 25 Mar 2016 10:50:42 -0700 Subject: [PATCH] removes --force --- src/core/index.js | 2 +- src/core/init.js | 7 +++---- test/core-tests/test-init.js | 19 ------------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/core/index.js b/src/core/index.js index 0f26ce8e53..08226abb5d 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -89,7 +89,7 @@ function IPFS (repo) { } this.repo = { - init: (bits, force, empty, callback) => { + init: (bits, empty, callback) => { // 1. check if repo already exists }, diff --git a/src/core/init.js b/src/core/init.js index 9d8f8a867a..9f3ab4416d 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -5,18 +5,17 @@ const path = require('path') module.exports = (repo, opts, callback) => { opts = opts || {} - opts.force = opts.force || false opts.emptyRepo = opts.emptyRepo || false opts.bits = opts.bits || 2048 // Pre-set config values. var config = require('../init-files/default-config.json') - // Verify repo does not yet exist (or that 'force' is provided). + // Verify repo does not yet exist. repo.exists((err, res) => { if (err) { return callback(err) } - if (res === true && !opts.force) { - return callback(new Error('repo already exists and \'force\' is not set')) + if (res === true) { + return callback(new Error('repo already exists')) } generateAndSetKeypair() diff --git a/test/core-tests/test-init.js b/test/core-tests/test-init.js index dc708aa135..b658f20494 100644 --- a/test/core-tests/test-init.js +++ b/test/core-tests/test-init.js @@ -53,23 +53,4 @@ describe('init', function () { }) }) }) - - it('force init (overwrite)', (done) => { - var repo = createTempRepo() - const ipfs1 = new IPFS(repo) - const ipfs2 = new IPFS(repo) - ipfs1.init({ bits: 128, emptyRepo: true }, (err) => { - expect(err).to.not.exist - - ipfs2.init({ bits: 128, force: false }, (err) => { - expect(err).to.exist - - ipfs2.init({ force: true }, (err) => { - expect(err).to.not.exist - - repo.teardown(done) - }) - }) - }) - }) })