Skip to content

Commit

Permalink
fix: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Oct 17, 2019
1 parent 3be4cf9 commit 8f38027
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,11 @@ class IpfsRepo {
autoMigrateConfig = await this.config.get(AUTO_MIGRATE_CONFIG_KEY)
} catch (e) {
if (e.code === ERRORS.NotFoundError.code) {
autoMigrateConfig = true
autoMigrateConfig = true // Config's default value is True
} else {
throw e
}
}
log(`optin: ${this.options.autoMigrate}; config: ${autoMigrateConfig}`)

return autoMigrateConfig && this.options.autoMigrate
}
Expand All @@ -298,10 +297,6 @@ class IpfsRepo {
throw new ERRORS.InvalidRepoVersionError('Your repo\'s version is higher then this version of js-ipfs-repo require! You have to revert it.')
}

if (currentRepoVersion === toVersion) {
return
}

log('migrating to version ' + toVersion)
return migrator.migrate(this.path, { toVersion: toVersion, ignoreLock: true, repoOptions: this.options })
}
Expand Down
4 changes: 1 addition & 3 deletions test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ async function createTempRepo ({ dontOpen, opts }) {

return {
path: repoPath,
instance: repo,
teardown: async () => {
}
instance: repo
}
}

Expand Down
1 change: 1 addition & 0 deletions test/migrations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const sinon = require('sinon')

const migrator = require('ipfs-repo-migrations')
const constants = require('../src/constants')
const config = require('../src/config')
const errors = require('../src/errors')
const IPFSRepo = require('../src')

Expand Down

0 comments on commit 8f38027

Please sign in to comment.