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) {
* @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