-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Initial commit for repoExists #776
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,16 @@ exports.ifRepoExists = (repo, cb) => { | |
| }) | ||
| } | ||
|
|
||
| exports.repoExists = (self) => { | ||
| return (cb) => { | ||
| self._repo.exists((err, exists) => { | ||
| if (err) { | ||
| return cb(err) | ||
| } | ||
|
|
||
| cb(err, exists) | ||
| }) | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's converge repoExists and ifRepoExists and make the converged function
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @aphelionz , how is the development of this feature?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @diasdavid Gonna push some more commit(s) today.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if you need any help :) |
||
|
|
||
| exports.OFFLINE_ERROR = new Error('This command must be run in online mode. Try running \'ipfs daemon\' first.') | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new utility function, we could just assign
this.repoExiststorepoInstance.existsand all should work. Would be less duplicated code + tests.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give that a shot. The test should still run against this.repoExists though, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would say we should still test it, to be sure. Better safe than sorry