Commit 51999d33 authored by Carson Howard's avatar Carson Howard

Added a better normalizeOptions pattern for the submodule update routine

parent bf1ff40c
......@@ -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);
......
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