Commit b21267c1 authored by Tyler Wanek's avatar Tyler Wanek Committed by GitHub

Merge pull request #1388 from cjhoward92/fix/submodule-update-noramlize-options

Added a better normalizeOptions pattern for the submodule update routine
parents c39cba3d a7fdc43e
...@@ -23,17 +23,28 @@ Submodule.foreach = function(repo, callback) { ...@@ -23,17 +23,28 @@ Submodule.foreach = function(repo, callback) {
* @return {Number} 0 on success, any non-zero return value from a callback * @return {Number} 0 on success, any non-zero return value from a callback
*/ */
Submodule.prototype.update = function(init, options) { Submodule.prototype.update = function(init, options) {
var fetchOpts = normalizeFetchOptions(options && options.fetchOpts); var fetchOpts;
var checkoutOpts;
if (options) { if (options) {
options = shallowClone(options); options = shallowClone(options);
fetchOpts = options.fetchOpts;
checkoutOpts = options.checkoutOpts;
delete options.fetchOpts; delete options.fetchOpts;
delete options.checkoutOpts;
} }
options = normalizeOptions(options, NodeGit.SubmoduleUpdateOptions); options = normalizeOptions(options, NodeGit.SubmoduleUpdateOptions);
if (options) { if (fetchOpts) {
options.fetchOpts = fetchOpts; options.fetchOpts = normalizeFetchOptions(fetchOpts);
}
if (checkoutOpts) {
options.checkoutOpts = normalizeOptions(
checkoutOpts,
NodeGit.CheckoutOptions
);
} }
return _update.call(this, init, options); return _update.call(this, init, options);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment