Skip to content

Commit 22afe87

Browse files
committed
Ensure remoteCallbacks aren't initialized as an object
1 parent 5459e38 commit 22afe87

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/clone.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ var clone = Clone.clone;
1212
* @param options
1313
*/
1414
Clone.clone = function(url, local_path, options) {
15+
var remoteCallbacks = options.remoteCallbacks;
16+
delete options.remoteCallbacks;
1517
options = normalizeOptions(options, NodeGit.CloneOptions);
16-
options.remoteCallbacks = normalizeOptions(options.remoteCallbacks,
18+
19+
options.remoteCallbacks = normalizeOptions(remoteCallbacks,
1720
NodeGit.RemoteCallbacks);
1821

1922
return clone.call(this, url, local_path, options);

lib/util/normalize_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @return {Object} An Oid instance.
66
*/
77
function normalizeOptions(options, Ctor) {
8-
var instance = new Ctor();
8+
var instance = options instanceof Ctor ? options : new Ctor();
99

1010
if (!options) {
1111
return null;

0 commit comments

Comments
 (0)