FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lib/reference.js at master · philschatz/nodegit · GitHub
philschatz
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lib
/
reference.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (59 loc) · 1.77 KB
Breadcrumbs
nodegit
/
lib
/
reference.js
Copy path
File metadata and controls
64 lines (59 loc) · 1.77 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
var
git
=
require
(
'../'
)
,
success
=
require
(
'./utilities'
)
.
success
;
/**
* Convenience reference constructor.
*
*
@constructor
*
@param
{
git.raw.Repo
} rawRepo
*
@param
{
git.raw.Reference
} [rawReference = new git.raw.Reference()]
*/
var
Reference
=
function
(
rawRepo
,
rawReference
)
{
if
(
!
(
rawRepo
instanceof
git
.
raw
.
Repo
)
)
{
throw
new
git
.
error
(
'First parameter for Reference must be a raw repo'
)
;
}
this
.
rawRepo
=
rawRepo
;
if
(
rawReference
instanceof
git
.
raw
.
Reference
)
{
this
.
rawReference
=
rawReference
;
}
else
{
this
.
rawReference
=
new
git
.
raw
.
Reference
(
this
.
rawRepo
)
;
}
}
;
/**
* Lookup the reference with the given name.
*
*
@param
{
String
} name
*
@param
{
Reference~lookupCallback
} callback
*/
Reference
.
prototype
.
lookup
=
function
(
name
,
callback
)
{
/**
*
@callback
Reference~lookupCallback Callback executed on lookup completion.
*
@param
{
GitError|null
} error An Error or null if successful.
*
@param
{
Reference|null
} reference Retrieved reference object or null.
*/
var
self
=
this
;
self
.
rawReference
.
lookup
(
self
.
rawRepo
,
name
,
function
referenceLookup
(
error
,
rawReference
)
{
if
(
!
success
(
error
,
callback
)
)
{
return
;
}
self
.
rawReference
=
rawReference
;
callback
(
null
,
self
)
;
}
)
;
}
;
/**
* Get the Oid representing this reference.
*
*
@param
{
Reference~oidCallback
} callback
*/
Reference
.
prototype
.
oid
=
function
(
callback
)
{
/**
*
@callback
Reference~oidCallback Callback executed on oid retrieval.
*
@param
{
GitError|null
} error An Error or null if successful.
*
@param
{
Oid|null
} oid Retrieved Oid object or null.
*/
this
.
rawReference
.
oid
(
function
referenceOid
(
error
,
rawOid
)
{
if
(
success
(
error
,
callback
)
)
{
callback
(
null
,
new
git
.
oid
(
rawOid
)
)
;
}
}
)
;
}
;
exports
.
reference
=
Reference
;
Back
|
FazBrowse Home
|
New Git URL