Index.entryIsConflict Sync

var result = Index.entryIsConflict(entry);
Parameters Type  
entry IndexEntry The entry
Returns  
Number 1 if the entry is a conflict entry, 0 otherwise

Index.entryStage Sync

var result = Index.entryStage(entry);
Parameters Type  
entry IndexEntry The entry
Returns  
Number the stage number

Index.open Async

Index.open(index_path).then(function(index) {
  // Use index
});
Parameters Type  
index_path String the path to the index file in disk
Returns  
Index  

Index#add Async

index.add(source_entry).then(function(result) {
  // Use result
});
Parameters Type  
source_entry IndexEntry new entry object
Returns  
Number 0 or an error code

Index#addAll Async

index.addAll(pathspec, flags, callback, payload).then(function(result) {
  // Use result
});
Parameters Type  
pathspec Strarray array of path patterns
flags Number combination of git_index_add_option_t flags
callback IndexMatchedPathCb notification callback for each added/updated path (also gets index of matching pathspec entry); can be NULL; return 0 to add, >0 to skip, <0 to abort scan.
payload Void payload passed through to callback function
Returns  
Number 0 on success, negative callback return value, or error code

Index#addByPath Async

index.addByPath(path).then(function(result) {
  // Use result
});
Parameters Type  
path String filename to add
Returns  
Number 0 or an error code

Index#caps Sync

var result = index.caps();
Returns  
Number A combination of GIT_INDEXCAP values

Index#checksum Sync

var oid = index.checksum();
Returns  
Oid the checksum of the index

Index#clear Async

index.clear().then(function(result) {
  // Use result
});

| Returns | | | — | — | | Number | 0 on success, error code < 0 on failure |

Index#conflictAdd Async

index.conflictAdd(ancestor_entry, our_entry, their_entry).then(function(result) {
  // Use result
});
Parameters Type  
ancestor_entry IndexEntry the entry data for the ancestor of the conflict
our_entry IndexEntry the entry data for our side of the merge conflict
their_entry IndexEntry the entry data for their side of the merge conflict
Returns  
Number 0 or an error code

Index#conflictCleanup Async

index.conflictCleanup().then(function(result) {
  // Use result
});
Returns  
Number 0 or an error code

Index#conflictGet Async

index.conflictGet(path).then(function(indexEntry) {
  // Use indexEntry
});
Parameters Type  
path String path to search
Returns  
IndexEntry  

Index#conflictRemove Async

index.conflictRemove(path).then(function(result) {
  // Use result
});
Parameters Type  
path String path to remove conflicts for
Returns  
Number 0 or an error code

Index#entries Sync

var arrayIndexEntry = index.entries();

Return an array of the entries in this index.

Returns  
Array<IndexEntry> an array of IndexEntrys

Index#entryCount Sync

var result = index.entryCount();
Returns  
Number integer of count of current entries

Index#find Async

index.find(path).then(function(result) {
  // Use result
});
Parameters Type  
path String path to search
Returns  
Number the address to which the position of the index entry is written (optional)

Index#findPrefix Async

index.findPrefix(prefix).then(function(result) {
  // Use result
});
Parameters Type  
prefix String the prefix to search for
Returns  
Number the address to which the position of the index entry is written (optional)

Index#getByIndex Sync

var indexEntry = index.getByIndex(n);
Parameters Type  
n Number the position of the entry
Returns  
IndexEntry the entry; NULL if out of bounds

Index#getByPath Sync

var indexEntry = index.getByPath(path, stage);
Parameters Type  
path String path to search
stage Number stage to search
Returns  
IndexEntry the entry; NULL if it was not found

Index#hasConflicts Sync

var result = index.hasConflicts();
Returns  
Number 1 if at least one conflict is found, 0 otherwise.

Index#path Sync

var string = index.path();
Returns  
String path to index file or NULL for in-memory index

Index#read Async

index.read(force).then(function(result) {
  // Use result
});
Parameters Type  
force Number if true, always reload, vs. only read if file has changed
Returns  
Number 0 or an error code

Index#readTree Async

index.readTree(tree).then(function(result) {
  // Use result
});
Parameters Type  
tree Tree tree to read
Returns  
Number 0 or an error code

Index#remove Async

index.remove(path, stage).then(function(result) {
  // Use result
});
Parameters Type  
path String path to search
stage Number stage to search
Returns  
Number 0 or an error code

Index#removeAll Async

index.removeAll(pathspec, callback, payload).then(function(result) {
  // Use result
});
Parameters Type  
pathspec Strarray array of path patterns
callback IndexMatchedPathCb notification callback for each removed path (also gets index of matching pathspec entry); can be NULL; return 0 to add, >0 to skip, <0 to abort scan.
payload Void payload passed through to callback function
Returns  
Number 0 on success, negative callback return value, or error code

Index#removeByPath Async

index.removeByPath(path).then(function(result) {
  // Use result
});
Parameters Type  
path String filename to remove
Returns  
Number 0 or an error code

Index#removeDirectory Async

index.removeDirectory(dir, stage).then(function(result) {
  // Use result
});
Parameters Type  
dir String container directory path
stage Number stage to search
Returns  
Number 0 or an error code

Index#setCaps Sync

var result = index.setCaps(caps);
Parameters Type  
caps Number A combination of GIT_INDEXCAP values
Returns  
Number 0 on success, -1 on failure

Index#setVersion Sync

var result = index.setVersion(version);
Parameters Type  
version Number The new version number
Returns  
Number 0 on success, -1 on failure

Index#updateAll Async

index.updateAll(pathspec, callback, payload).then(function(result) {
  // Use result
});
Parameters Type  
pathspec Strarray array of path patterns
callback IndexMatchedPathCb notification callback for each updated path (also gets index of matching pathspec entry); can be NULL; return 0 to add, >0 to skip, <0 to abort scan.
payload Void payload passed through to callback function
Returns  
Number 0 on success, negative callback return value, or error code

Index#version Sync

var result = index.version();
Returns  
Number the index version

Index#write Async

index.write().then(function(result) {
  // Use result
});
Returns  
Number 0 or an error code

Index#writeTree Async

index.writeTree().then(function(oid) {
  // Use oid
});
Returns  
Oid the OID of the written tree

Index#writeTreeTo Async

index.writeTreeTo(repo).then(function(oid) {
  // Use oid
});
Parameters Type  
repo Repository Repository where to write the tree
Returns  
Oid OID of the the written tree

Index.ADD_OPTION ENUM

Flag Value
Index.ADD_OPTION.ADD_DEFAULT 0
Index.ADD_OPTION.ADD_FORCE 1
Index.ADD_OPTION.ADD_DISABLE_PATHSPEC_MATCH 2
Index.ADD_OPTION.ADD_CHECK_PATHSPEC 4

Index.CAP ENUM

Flag Value
Index.CAP.IGNORE_CASE 1
Index.CAP.NO_FILEMODE 2
Index.CAP.NO_SYMLINKS 4
Index.CAP.FROM_OWNER -1