FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit.nodegit/test/tests/clone.js at master · javascript-forks/nodegit.nodegit · GitHub
javascript-forks
nodegit.nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit.nodegit
/
test
/
tests
/
clone.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
159 lines (137 loc) · 3.96 KB
Breadcrumbs
nodegit.nodegit
/
test
/
tests
/
clone.js
Copy path
File metadata and controls
159 lines (137 loc) · 3.96 KB
Raw
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
var
path
=
require
(
"path"
)
;
var
assert
=
require
(
"assert"
)
;
var
promisify
=
require
(
"promisify-node"
)
;
var
fse
=
promisify
(
require
(
"fs-extra"
)
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
describe
(
"Clone"
,
function
(
)
{
var
NodeGit
=
require
(
"../../"
)
;
var
Repository
=
NodeGit
.
Repository
;
var
Clone
=
NodeGit
.
Clone
;
var
clonePath
=
local
(
"../repos/clone"
)
;
var
sshPublicKey
=
local
(
"../id_rsa.pub"
)
;
var
sshPrivateKey
=
local
(
"../id_rsa"
)
;
// Set a reasonable timeout here now that our repository has grown.
this
.
timeout
(
30000
)
;
beforeEach
(
function
(
)
{
return
fse
.
remove
(
clonePath
)
.
catch
(
function
(
err
)
{
console
.
log
(
err
)
;
throw
err
;
}
)
;
}
)
;
it
(
"can clone with http"
,
function
(
)
{
var
test
=
this
;
var
url
=
"http://git.tbranyen.com/smart/site-content"
;
return
Clone
(
url
,
clonePath
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"can clone with https"
,
function
(
)
{
var
test
=
this
;
var
url
=
"https://github.com/nodegit/test.git"
;
var
opts
=
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
}
}
;
return
Clone
(
url
,
clonePath
,
opts
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"can clone using nested function"
,
function
(
)
{
var
test
=
this
;
var
url
=
"https://github.com/nodegit/test.git"
;
var
opts
=
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
}
}
;
return
Clone
.
clone
(
url
,
clonePath
,
opts
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"can clone with ssh"
,
function
(
)
{
var
test
=
this
;
var
url
=
"git@github.com:nodegit/test.git"
;
var
opts
=
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
,
credentials
:
function
(
url
,
userName
)
{
return
NodeGit
.
Cred
.
sshKeyFromAgent
(
userName
)
;
}
}
}
;
return
Clone
(
url
,
clonePath
,
opts
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"can clone with ssh while manually loading a key"
,
function
(
)
{
var
test
=
this
;
var
url
=
"git@github.com:nodegit/test.git"
;
var
opts
=
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
,
credentials
:
function
(
url
,
userName
)
{
return
NodeGit
.
Cred
.
sshKeyNew
(
userName
,
sshPublicKey
,
sshPrivateKey
,
""
)
;
}
}
}
;
return
Clone
(
url
,
clonePath
,
opts
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"can clone with git"
,
function
(
)
{
var
test
=
this
;
var
url
=
"git://github.com/nodegit/test.git"
;
var
opts
=
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
}
}
;
return
Clone
(
url
,
clonePath
,
opts
)
.
then
(
function
(
repo
)
{
test
.
repository
=
repo
;
assert
.
ok
(
repo
instanceof
Repository
)
;
}
)
;
}
)
;
it
(
"can clone with filesystem"
,
function
(
)
{
var
test
=
this
;
var
prefix
=
process
.
platform
===
"win32"
?
""
:
"file://"
;
var
url
=
prefix
+
local
(
"../repos/empty"
)
;
return
Clone
(
url
,
clonePath
)
.
then
(
function
(
repo
)
{
assert
.
ok
(
repo
instanceof
Repository
)
;
test
.
repository
=
repo
;
}
)
;
}
)
;
it
(
"will not segfault when accessing a url without username"
,
function
(
)
{
var
url
=
"https://github.com/nodegit/private"
;
return
Clone
(
url
,
clonePath
,
{
remoteCallbacks
:
{
certificateCheck
:
function
(
)
{
return
1
;
}
,
credentials
:
function
(
)
{
return
NodeGit
.
Cred
.
userpassPlaintextNew
(
"fake-token"
,
"x-oauth-basic"
)
;
}
}
}
)
.
catch
(
function
unhandledError
(
)
{
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL