Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
106 lines (89 loc) · 2.99 KB

File metadata and controls

106 lines (89 loc) · 2.99 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
var assert = require("assert");
var path = require("path");
var Promise = require("nodegit-promise");
var promisify = require("promisify-node");
var fse = promisify(require("fs-extra"));
describe("Clone", function() {
var http = path.resolve("test/repos/http");
var https = path.resolve("test/repos/https");
var ssh = path.resolve("test/repos/ssh");
var sshManual = path.resolve("test/repos/sshmanual");
var git = path.resolve("test/repos/git");
var file = path.resolve("test/repos/file");
var sshPublicKey = path.resolve("./id_rsa.pub");
var sshPrivateKey = path.resolve("./id_rsa");
var Repository = require("../../lib/repository");
var Clone = require("../../lib/clone");
var NodeGit = require("../../");
// Set a reasonable timeout here now that our repository has grown.
this.timeout(15000);
before(function() {
return Promise.all([
fse.remove(http),
fse.remove(https),
fse.remove(ssh),
fse.remove(git),
fse.remove(file),
]);
});
it("can clone with http", function() {
var url = "http://github.com/nodegit/test.git";
var opts = { ignoreCertErrors: 1 };
return Clone.clone(url, http, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
it("can clone with https", function() {
var url = "https://github.com/nodegit/test.git";
var opts = { ignoreCertErrors: 1 };
return Clone.clone(url, https, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
it("can clone with ssh", function() {
var url = "git@github.com:nodegit/test.git";
var opts = {
ignoreCertErrors: 1,
remoteCallbacks: {
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyFromAgent(userName);
}
}
};
return Clone.clone(url, ssh, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
it("can clone with ssh while manually loading a key", function() {
var url = "git@github.com:nodegit/test.git";
var opts = {
ignoreCertErrors: 1,
remoteCallbacks: {
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyNew(
userName,
sshPublicKey,
sshPrivateKey,
"");
}
}
};
return Clone.clone(url, sshManual, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
it("can clone with git", function() {
var url = "git://github.com/nodegit/test.git";
var opts = { ignoreCertErrors: 1 };
return Clone.clone(url, git, opts).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
it("can clone with filesystem", function() {
var prefix = process.platform === "win32" ? "" : "file://";
var url = prefix + path.resolve("test/repos/empty");
return Clone.clone(url, file).then(function(repository) {
assert.ok(repository instanceof Repository);
});
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.