From 999f269e36247321f3e0ecad816e342db18436af Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Fri, 18 Aug 2017 09:19:30 +0200 Subject: [PATCH] Fix resin preload when a commit is provided. Connects-To #629 Change-Type: patch --- build/actions/preload.js | 4 +++- lib/actions/preload.coffee | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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)