FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lib/clone.js at v0.6.3 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
23
(23)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lib
/
clone.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (49 loc) · 1.6 KB
Breadcrumbs
nodegit
/
lib
/
clone.js
Copy path
File metadata and controls
60 lines (49 loc) · 1.6 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
var
NodeGit
=
require
(
"../"
)
;
var
shallowClone
=
require
(
"./utils/shallow_clone"
)
;
var
normalizeOptions
=
NodeGit
.
Utils
.
normalizeOptions
;
var
Clone
=
NodeGit
.
Clone
;
var
clone
=
Clone
.
clone
;
/**
* Patch repository cloning to automatically coerce objects.
*
*
@async
*
@param
{
String
} url url of the repository
*
@param
{
String
} local_path local path to store repository
*
@param
{
CloneOptions
} [options]
*
@return
{
Repository
} repo
*/
Clone
.
clone
=
function
(
url
,
local_path
,
options
)
{
var
remoteCallbacks
=
{
}
;
var
fetchOpts
=
{
}
;
if
(
options
)
{
options
=
shallowClone
(
options
)
;
if
(
options
.
fetchOpts
)
{
fetchOpts
=
shallowClone
(
options
.
fetchOpts
)
;
}
delete
options
.
fetchOpts
;
}
options
=
normalizeOptions
(
options
,
NodeGit
.
CloneOptions
)
;
if
(
fetchOpts
.
callbacks
)
{
remoteCallbacks
=
shallowClone
(
fetchOpts
.
callbacks
)
;
delete
fetchOpts
.
callbacks
;
}
fetchOpts
=
normalizeOptions
(
fetchOpts
,
NodeGit
.
FetchOptions
)
;
fetchOpts
.
callbacks
=
normalizeOptions
(
remoteCallbacks
,
NodeGit
.
RemoteCallbacks
)
;
if
(
options
)
{
options
.
fetchOpts
=
fetchOpts
;
}
// This is required to clean up after the clone to avoid file locking
// issues in Windows and potentially other issues we don't know about.
var
freeRepository
=
function
(
repository
)
{
repository
.
free
(
)
;
}
;
// We want to provide a valid repository object, so reopen the repository
// after clone and cleanup.
var
openRepository
=
function
(
)
{
return
NodeGit
.
Repository
.
open
(
local_path
)
;
}
;
return
clone
.
call
(
this
,
url
,
local_path
,
options
)
.
then
(
freeRepository
)
.
then
(
openRepository
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL