diff --git a/build/actions/preload.js b/build/actions/preload.js index 8fc96c8b..2195c738 100644 --- a/build/actions/preload.js +++ b/build/actions/preload.js @@ -188,7 +188,9 @@ module.exports = { } return Promise["try"](function() { if (options.commit) { - if (_.map(builds, 'commit_hash').indexOf(options.commit) === -1) { + if (!_.find(application.build, { + commit_hash: options.commit + })) { expectedError('There is no build matching this commit'); } return options.commit; diff --git a/lib/actions/preload.coffee b/lib/actions/preload.coffee index 70f3437b..72c7243a 100644 --- a/lib/actions/preload.coffee +++ b/lib/actions/preload.coffee @@ -196,7 +196,7 @@ module.exports = # Use the commit given as --commit or show an interactive commit selection menu Promise.try -> if options.commit - if _.map(builds, 'commit_hash').indexOf(options.commit) == -1 + if not _.find(application.build, commit_hash: options.commit) expectedError('There is no build matching this commit') return options.commit selectApplicationCommit(expectedError, resin, form, application.build)