Skip to content

Latest commit

 

History

History
610 lines (465 loc) · 17.9 KB

File metadata and controls

610 lines (465 loc) · 17.9 KB
layout menu_item title description return_to sections
default
api
Reference
Version 0.26.1
API Documentation Index
/api/
create createMatching dwim ensureLog hasLog isValidName list lookup nameToId normalizeName remove symbolicCreate symbolicCreateMatching updateTerminal #cmp #delete #dup #isBranch #isConcrete #isHead #isNote #isRemote #isSymbolic #isTag #isValid #name #owner #peel #rename #resolve #setTarget #shorthand #symbolicSetTarget #symbolicTarget #target #targetPeel #toString #type FORMAT TYPE
#create
#createMatching
#dwim
#ensureLog
#hasLog
#isValidName
#list
#lookup
#nameToId
#normalizeName
#remove
#symbolicCreate
#symbolicCreateMatching
#updateTerminal
#cmp
#delete
#dup
#isBranch
#isConcrete
#isHead
#isNote
#isRemote
#isSymbolic
#isTag
#isValid
#name
#owner
#peel
#rename
#resolve
#setTarget
#shorthand
#symbolicSetTarget
#symbolicTarget
#target
#targetPeel
#toString
#type
#FORMAT
#TYPE

Reference.create AsyncExperimental

Reference.create(repo, name, id, force, log_message).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository Repository where that reference will live
name String The name of the reference
id Oid The object id pointed to by the reference.
force Number Overwrite existing references
log_message String The one line long message to be appended to the reflog
Returns
Reference

Reference.createMatching AsyncExperimental

Reference.createMatching(repo, name, id, force, current_id, log_message).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository Repository where that reference will live
name String The name of the reference
id Oid The object id pointed to by the reference.
force Number Overwrite existing references
current_id Oid The expected value of the reference at the time of update
log_message String The one line long message to be appended to the reflog
Returns
Reference

Reference.dwim Async

Reference.dwim(repo, id, callback).then(function(reference) {
  // Use reference
});

Retrieves the reference by it's short name

Parameters Type
repo Repository The repo that the reference lives in
id String, Reference The reference to lookup
callback Function
Returns
Reference

Reference.ensureLog SyncExperimental

var result = Reference.ensureLog(repo, refname);
Parameters Type
repo Repository the repository
refname String the reference's name
Returns
Number 0 or an error code.

Reference.hasLog SyncExperimental

var result = Reference.hasLog(repo, refname);
Parameters Type
repo Repository the repository
refname String the reference's name
Returns
Number 0 when no reflog can be found, 1 when it exists;
otherwise an error code.

Reference.isValidName SyncExperimental

var result = Reference.isValidName(refname);
Parameters Type
refname String name to be checked.
Returns
Number 1 if the reference name is acceptable; 0 if it isn't

Reference.list AsyncExperimental

Reference.list(repo).then(function(array) {
  // Use array
});
Parameters Type
repo Repository Repository where to find the refs
Returns
Array

Reference.lookup Async

Reference.lookup(repo, id, callback).then(function(reference) {
  // Use reference
});

Retrieves the reference pointed to by the oid

Parameters Type
repo Repository The repo that the reference lives in
id String, Reference The reference to lookup
callback Function
Returns
Reference

Reference.nameToId AsyncExperimental

Reference.nameToId(repo, name).then(function(oid) {
  // Use oid
});
Parameters Type
repo Repository The repository in which to look up the reference
name String The long name for the reference (e.g. HEAD, refs/heads/master, refs/tags/v0.1.0, ...)
Returns
Oid

Reference.normalizeName SyncExperimental

var result = Reference.normalizeName(buffer_out, buffer_size, name, flags);
Parameters Type
buffer_out String User allocated buffer to store normalized name
buffer_size Number Size of buffer_out
name String Reference name to be checked.
flags Number Flags to constrain name validation rules - see the GIT_REFERENCE_FORMAT constants above.
Returns
Number 0 on success, GIT_EBUFS if buffer is too small, GIT_EINVALIDSPEC
or an error code.

Reference.remove SyncExperimental

var result = Reference.remove(repo, name);
Parameters Type
repo Repository
name String The reference to remove
Returns
Number 0 or an error code

Reference.symbolicCreate AsyncExperimental

Reference.symbolicCreate(repo, name, target, force, log_message).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository Repository where that reference will live
name String The name of the reference
target String The target of the reference
force Number Overwrite existing references
log_message String The one line long message to be appended to the reflog
Returns
Reference

Reference.symbolicCreateMatching AsyncExperimental

Reference.symbolicCreateMatching(repo, name, target, force, current_value, log_message).then(function(reference) {
  // Use reference
});
Parameters Type
repo Repository Repository where that reference will live
name String The name of the reference
target String The target of the reference
force Number Overwrite existing references
current_value String The expected value of the reference when updating
log_message String The one line long message to be appended to the reflog
Returns
Reference

Reference.updateTerminal Async

Reference.updateTerminal(repo, refName, oid, logMessage, signature).then(function() {
  // method complete});

Given a reference name, follows symbolic links and updates the direct reference to point to a given OID. Updates the reflog with a given message.

Parameters Type
repo Repository The repo where the reference and objects live
refName String The reference name to update
oid Oid The target OID that the reference will point to
logMessage String The reflog message to be writted
signature Signature Optional signature to use for the reflog entry

Reference#cmp SyncExperimental

var result = reference.cmp(ref2);

| Parameters | Type | | --- | --- | --- | | ref2 | Reference | The second git_reference |

Returns
Number 0 if the same, else a stable but meaningless ordering.

Reference#delete SyncExperimental

var result = reference.delete();
Returns
Number 0, GIT_EMODIFIED or an error code

Reference#dup AsyncExperimental

reference.dup().then(function(reference) {
  // Use reference
});
Returns
Reference the copy

Reference#isBranch SyncExperimental

var result = reference.isBranch();
Returns
Number 1 when the reference lives in the refs/heads
namespace; 0 otherwise.

Reference#isConcrete Sync

var boolean = reference.isConcrete();

Returns true if this reference is not symbolic

Returns
Boolean

Reference#isHead Sync

var boolean = reference.isHead();

Returns if the ref is pointed at by HEAD

Returns
Boolean

Reference#isNote SyncExperimental

var result = reference.isNote();
Returns
Number 1 when the reference lives in the refs/notes
namespace; 0 otherwise.

Reference#isRemote SyncExperimental

var result = reference.isRemote();
Returns
Number 1 when the reference lives in the refs/remotes
namespace; 0 otherwise.

Reference#isSymbolic Sync

var boolean = reference.isSymbolic();

Returns true if this reference is symbolic

Returns
Boolean

Reference#isTag SyncExperimental

var result = reference.isTag();
Returns
Number 1 when the reference lives in the refs/tags
namespace; 0 otherwise.

Reference#isValid Sync

var boolean = reference.isValid();

Returns true if this reference is valid

Returns
Boolean

Reference#name SyncExperimental

var string = reference.name();
Returns
String the full name for the ref

Reference#owner SyncExperimental

var repository = reference.owner();
Returns
Repository the repo

Reference#peel AsyncExperimental

reference.peel(type).then(function(object) {
  // Use object
});

| Parameters | Type | | --- | --- | --- | | type | Number | The type of the requested object (GIT_OBJECT_COMMIT, GIT_OBJECT_TAG, GIT_OBJECT_TREE, GIT_OBJECT_BLOB or GIT_OBJECT_ANY). |

Returns
Object

Reference#rename AsyncExperimental

reference.rename(new_name, force, log_message).then(function(reference) {
  // Use reference
});

| Parameters | Type | | --- | --- | --- | | new_name | String | The new name for the reference | | force | Number | Overwrite an existing reference | | log_message | String | The one line long message to be appended to the reflog |

Returns
Reference

Reference#resolve AsyncExperimental

reference.resolve().then(function(reference) {
  // Use reference
});
Returns
Reference

Reference#setTarget AsyncExperimental

reference.setTarget(id, log_message).then(function(reference) {
  // Use reference
});

| Parameters | Type | | --- | --- | --- | | id | Oid | The new target OID for the reference | | log_message | String | The one line long message to be appended to the reflog |

Returns
Reference

Reference#shorthand SyncExperimental

var string = reference.shorthand();
Returns
String the human-readable version of the name

Reference#symbolicSetTarget AsyncExperimental

reference.symbolicSetTarget(target, log_message).then(function(reference) {
  // Use reference
});

| Parameters | Type | | --- | --- | --- | | target | String | The new target for the reference | | log_message | String | The one line long message to be appended to the reflog |

Returns
Reference

Reference#symbolicTarget SyncExperimental

var string = reference.symbolicTarget();
Returns
String the name if available, NULL otherwise

Reference#target SyncExperimental

var oid = reference.target();
Returns
Oid the oid if available, NULL otherwise

Reference#targetPeel SyncExperimental

var oid = reference.targetPeel();
Returns
Oid the oid if available, NULL otherwise

Reference#toString Sync

var string = reference.toString();

Returns the name of the reference.

Returns
String

Reference#type SyncExperimental

var result = reference.type();
Returns
Number the type

Reference.FORMAT ENUM

| Flag | Value | | --- | --- | --- | | Reference.FORMAT.NORMAL | 0 | | Reference.FORMAT.ALLOW_ONELEVEL | 1 | | Reference.FORMAT.REFSPEC_PATTERN | 2 | | Reference.FORMAT.REFSPEC_SHORTHAND | 4 |

Reference.TYPE ENUM

| Flag | Value | | --- | --- | --- | | Reference.TYPE.INVALID | 0 | | Reference.TYPE.DIRECT | 1 | | Reference.TYPE.SYMBOLIC | 2 | | Reference.TYPE.ALL | 3 |