From 51999d3325d5d6b439148cf18a12c24bbeea27b2 Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Tue, 10 Oct 2017 12:32:55 -0700 Subject: [PATCH 1/2] Added a better normalizeOptions pattern for the submodule update routine --- lib/submodule.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/submodule.js b/lib/submodule.js index 534fb2c9c..f7cff2e9a 100644 --- a/lib/submodule.js +++ b/lib/submodule.js @@ -23,17 +23,25 @@ Submodule.foreach = function(repo, callback) { * @return {Number} 0 on success, any non-zero return value from a callback */ Submodule.prototype.update = function(init, options) { - var fetchOpts = normalizeFetchOptions(options && options.fetchOpts); + var fetchOpts; + var checkoutOpts; if (options) { options = shallowClone(options); + fetchOpts = options.fetchOpts; + checkoutOpts = options.checkoutOpts; delete options.fetchOpts; + delete options.checkoutOpts; } - + options = normalizeOptions(options, NodeGit.SubmoduleUpdateOptions); - if (options) { - options.fetchOpts = fetchOpts; + if (fetchOpts) { + options.fetchOpts = normalizeFetchOptions(fetchOpts); + } + + if (checkoutOpts) { + options.checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions); } return _update.call(this, init, options); From a7fdc43e7a41db793fc4c4d31111a4ae1bd312ec Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Tue, 10 Oct 2017 12:51:34 -0700 Subject: [PATCH 2/2] linter --- lib/submodule.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/submodule.js b/lib/submodule.js index f7cff2e9a..92b0e6ec0 100644 --- a/lib/submodule.js +++ b/lib/submodule.js @@ -41,7 +41,10 @@ Submodule.prototype.update = function(init, options) { } if (checkoutOpts) { - options.checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions); + options.checkoutOpts = normalizeOptions( + checkoutOpts, + NodeGit.CheckoutOptions + ); } return _update.call(this, init, options);