Skip to content

Commit c313718

Browse files
committed
Ensure that clone is loaded and normalize works
1 parent 2af4f78 commit c313718

4 files changed

Lines changed: 8 additions & 17 deletions

File tree

lib/clone.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ var clone = Clone.clone;
1313
*/
1414
Clone.clone = function(url, local_path, options) {
1515
options = normalizeOptions(options, NodeGit.CloneOptions);
16-
17-
return clone.apply(this, arguments);
16+
return clone.call(this, url, local_path, options);
1817
};
1918

2019
module.exports = Clone;

lib/nodegit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ exports.__proto__ = rawApi;
4141
// Import extensions
4242
require("./attr");
4343
require("./blob");
44+
require("./clone");
4445
require("./checkout");
4546
require("./commit");
4647
require("./diff");

lib/util/normalize_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function normalizeOptions(options, Ctor) {
88
var instance = new Ctor();
99

1010
if (!options) {
11-
return instance;
11+
return null;
1212
}
1313

1414
Object.keys(options).forEach(function(key) {

test/tests/clone.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe("Clone", function() {
1313

1414
var Repository = require("../../lib/repository");
1515
var Clone = require("../../lib/clone");
16-
var NodeGit = require("../../");
1716

1817
before(function() {
1918
return Promise.all([
@@ -27,9 +26,7 @@ describe("Clone", function() {
2726

2827
it("can clone with http", function() {
2928
var url = "http://github.com/nodegit/test.git";
30-
var opts = new NodeGit.CloneOptions();
31-
32-
opts.ignoreCertErrors = 1;
29+
var opts = { ignoreCertErrors: 1 };
3330

3431
return Clone.clone(url, http, opts).then(function(repository) {
3532
assert.ok(repository instanceof Repository);
@@ -38,9 +35,7 @@ describe("Clone", function() {
3835

3936
it("can clone with https", function() {
4037
var url = "https://github.com/nodegit/test.git";
41-
var opts = new NodeGit.CloneOptions();
42-
43-
opts.ignoreCertErrors = 1;
38+
var opts = { ignoreCertErrors: 1 };
4439

4540
return Clone.clone(url, https, opts).then(function(repository) {
4641
assert.ok(repository instanceof Repository);
@@ -49,9 +44,7 @@ describe("Clone", function() {
4944

5045
it("can clone with ssh", function() {
5146
var url = "git@github.com:nodegit/test.git";
52-
var opts = new NodeGit.CloneOptions();
53-
54-
opts.ignoreCertErrors = 1;
47+
var opts = { ignoreCertErrors: 1 };
5548

5649
return Clone.clone(url, ssh, opts).then(function(repository) {
5750
assert.ok(repository instanceof Repository);
@@ -60,9 +53,7 @@ describe("Clone", function() {
6053

6154
it("can clone with git", function() {
6255
var url = "git://github.com/nodegit/test.git";
63-
var opts = new NodeGit.CloneOptions();
64-
65-
opts.ignoreCertErrors = 1;
56+
var opts = { ignoreCertErrors: 1 };
6657

6758
return Clone.clone(url, git, opts).then(function(repository) {
6859
assert.ok(repository instanceof Repository);
@@ -72,7 +63,7 @@ describe("Clone", function() {
7263
it("can clone with filesystem", function() {
7364
var url = "file://" + path.resolve("test/repos/empty");
7465

75-
return Clone.clone(url, file, null).then(function(repository) {
66+
return Clone.clone(url, file).then(function(repository) {
7667
assert.ok(repository instanceof Repository);
7768
});
7869
});

0 commit comments

Comments
 (0)