FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/utils/worker.js at master · CodeHunterDev/nodegit · GitHub
CodeHunterDev
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
utils
/
worker.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (34 loc) · 957 Bytes
Breadcrumbs
nodegit
/
test
/
utils
/
worker.js
Copy path
File metadata and controls
38 lines (34 loc) · 957 Bytes
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
const
{
isMainThread
,
parentPort
,
workerData
}
=
require
(
"worker_threads"
)
;
const
assert
=
require
(
"assert"
)
;
const
NodeGit
=
require
(
"../../"
)
;
if
(
isMainThread
)
{
throw
new
Error
(
"Must be run via worker thread"
)
;
}
parentPort
.
postMessage
(
"init"
)
;
const
{
clonePath
,
url
}
=
workerData
;
const
opts
=
{
fetchOpts
:
{
callbacks
:
{
certificateCheck
:
(
)
=>
0
}
}
}
;
let
repository
;
return
NodeGit
.
Clone
(
url
,
clonePath
,
opts
)
.
then
(
(
_repository
)
=>
{
repository
=
_repository
;
assert
.
ok
(
repository
instanceof
NodeGit
.
Repository
)
;
return
repository
.
index
(
)
;
}
)
.
then
(
(
index
)
=>
{
assert
.
ok
(
index
instanceof
NodeGit
.
Index
)
;
return
repository
.
getRemoteNames
(
)
;
}
)
.
then
(
(
remotes
)
=>
{
assert
.
ok
(
Array
.
isArray
(
remotes
)
)
;
return
repository
.
getCurrentBranch
(
)
;
}
)
.
then
(
(
branch
)
=>
{
assert
.
ok
(
branch
instanceof
NodeGit
.
Reference
)
;
parentPort
.
postMessage
(
"success"
)
;
}
)
.
catch
(
(
)
=>
parentPort
.
postMessage
(
"failure"
)
)
;
Back
|
FazBrowse Home
|
New Git URL