Object.lookup
Object.lookup(repo, id, type).then(function(object) {
// Use object
});
| Parameters | Type | |
|---|---|---|
| repo | Repository | the repository to look up the object |
| id | Oid | the unique identifier for the object |
| type | Number | the type of the object |
| Returns | |
|---|---|
| Object |
Object.lookupPrefix
Object.lookupPrefix(repo, id, len, type).then(function(object) {
// Use object
});
| Parameters | Type | |
|---|---|---|
| repo | Repository | the repository to look up the object |
| id | Oid | a short identifier for the object |
| len | Number | the length of the short identifier |
| type | Number | the type of the object |
| Returns | |
|---|---|
| Object | the looked-up object |
Object.size
var result = Object.size(type);
| Parameters | Type | |
|---|---|---|
| type | Number | object type to get its size |
| Returns | |
|---|---|
| Number | size in bytes of the object |
Object.string2Type
var result = Object.string2Type(str);
| Parameters | Type | |
|---|---|---|
| str | String | the string to convert. |
| Returns | |
|---|---|
| Number | the corresponding git_object_t. |
Object.type2String
var string = Object.type2String(type);
| Parameters | Type | |
|---|---|---|
| type | Number | object type to convert. |
| Returns | |
|---|---|
| String | the corresponding string representation. |
Object.typeisloose
var result = Object.typeisloose(type);
| Parameters | Type | |
|---|---|---|
| type | Number | object type to test. |
| Returns | |
|---|---|
| Number | true if the type represents a valid loose object type, |
| false otherwise. |
Object#dup
object.dup().then(function(object) {
// Use object
});
| Returns | |
|---|---|
| Object |
Object#id
var oid = object.id();
| Returns | |
|---|---|
| Oid | the SHA1 id |
Object#lookupByPath
object.lookupByPath(path, type).then(function(object) {
// Use object
});
| Parameters | Type | |
|---|---|---|
| path | String | relative path from the root object to the desired object |
| type | Number | type of object desired |
| Returns | |
|---|---|
| Object | buffer that receives the object (which must be freed |
| by the caller) |
Object#owner
var repository = object.owner();
| Returns | |
|---|---|
| Repository | the repository who owns this object |
Object#peel
object.peel(target_type).then(function(object) {
// Use object
});
| Parameters | Type | |
|---|---|---|
| target_type | Number | The type of the requested object (a GIT_OBJECT_ value) |
| Returns | |
|---|---|
| Object |
Object#shortId
object.shortId().then(function(buf) {
// Use buf
});
| Returns | |
|---|---|
| Buf | Buffer to write string into |
Object#type
var result = object.type();
| Returns | |
|---|---|
| Number | the object’s type |
Object.TYPE
| Flag | Value |
|---|---|
| Object.TYPE.ANY | -2 |
| Object.TYPE.INVALID | -1 |
| Object.TYPE.COMMIT | 1 |
| Object.TYPE.TREE | 2 |
| Object.TYPE.BLOB | 3 |
| Object.TYPE.TAG | 4 |
| Object.TYPE.OFS_DELTA | 6 |
| Object.TYPE.REF_DELTA | 7 |