Skip to content

Latest commit

 

History

History
710 lines (538 loc) · 19.8 KB

index.md

File metadata and controls

710 lines (538 loc) · 19.8 KB
layout default
menu_item api
title Commit
description Version 0.26.1
return_to
API Documentation Index
/api/
sections
create createBuffer createV createWithSignature extractSignature lookup lookupPrefix #amend #amendWithSignature #author #authorWithMailmap #body #committer #committerWithMailmap #date #dup #getDiff #getDiffWithOptions #getEntry #getParents #getSignature #getTree #headerField #history #id #message #messageEncoding #messageRaw #nthGenAncestor #owner #parent #parentId #parentcount #parents #rawHeader #sha #summary #time #timeMs #timeOffset #toString #tree #treeId
#create
#createBuffer
#createV
#createWithSignature
#extractSignature
#lookup
#lookupPrefix
#amend
#amendWithSignature
#author
#authorWithMailmap
#body
#committer
#committerWithMailmap
#date
#dup
#getDiff
#getDiffWithOptions
#getEntry
#getParents
#getSignature
#getTree
#headerField
#history
#id
#message
#messageEncoding
#messageRaw
#nthGenAncestor
#owner
#parent
#parentId
#parentcount
#parents
#rawHeader
#sha
#summary
#time
#timeMs
#timeOffset
#toString
#tree
#treeId

Commit.create Async

Commit.create(repo, update_ref, author, committer, message_encoding, message, tree, parent_count, parents).then(function(oid) {
  // Use oid
});
Parameters Type
repo Repository Repository where to store the muthaf*ckin' commit
update_ref String If not NULL, name of the damn reference that will be updated to point to this f*ckin' commit, goddammit. If the reference is not direct, it will be resolved to a direct reference. Use "HEAD" to update the HEAD of the current branch and make it point to this commit. Hold the f*ck up — If the reference doesn't exist yet, it will be created. Write that down. If it does exist, the muthaf*ckin' first parent must be the motherf*ckin' tip of this branch.
author Signature Signature with author and author time of commit
committer Signature Signature with committer and * commit time of commit
message_encoding String The encoding for the message in the f*ckin' commit, represented with a standard encoding name. E.g. "UTF-8". If NULL, no encoding header is written and UTF-8 is assumed.
message String Full message for this commit
tree Tree An instance of a git_tree object that will be used as the muthaf*ckin' tree for the commit. This muthaf*ckin' tree object must also be owned by the given repo.
parent_count Number Number of parents for this motherf*ckin' commit
parents Array Array of parent_count pointers to git_commit objects that will be used as the parents for this commit. This bad-ass array may be NULL if parent_count is 0 (root commit). All the given commits must be owned by the repo.
Returns
Oid

Commit.createBuffer Async

Commit.createBuffer(repo, author, committer, message_encoding, message, tree, parent_count, parents).then(function(buffer) {
  // Use buffer
});
Parameters Type
repo Repository Repository where the referenced tree and parents live
author Signature Signature with author and author time of commit
committer Signature Signature with committer and * commit time of commit
message_encoding String The encoding for the message in the f*ckin' commit, represented with a standard encoding name. E.g. "UTF-8". If NULL, no encoding header is written and UTF-8 is assumed.
message String Full message for this commit
tree Tree An instance of a git_tree object that will be used as the muthaf*ckin' tree for the commit. This muthaf*ckin' tree object must also be owned by the given repo.
parent_count Number Number of parents for this motherf*ckin' commit
parents Array Array of parent_count pointers to git_commit objects that will be used as the parents for this commit. This bad-ass array may be NULL if parent_count is 0 (root commit). All the given commits must be owned by the repo.
Returns
Buffer the buffer into which to write the commit object content

Commit.createV Sync

var result = Commit.createV(id, repo, update_ref, author, committer, message_encoding, message, tree, parent_count);
Parameters Type
id Oid
repo Repository
update_ref String
author Signature
committer Signature
message_encoding String
message String
tree Tree
parent_count Number
Returns
Number

Commit.createWithSignature Async

Commit.createWithSignature(repo, commit_content, signature, signature_field).then(function(oid) {
  // Use oid
});
Parameters Type
repo Repository
commit_content String the content of the unsigned commit object
signature String the signature to add to the motherf*ckin' commit. Leave NULL to create a f*ckin' commit without adding a signature field.
signature_field String which header field should contain this signature — no bullsh*t. Leave NULL for the muthaf*ckin' default of "gpgsig"
Returns
Oid the resulting commit id

Commit.extractSignature Async

Commit.extractSignature(signature, signed_data, repo, commit_id, field).then(function(result) {
  // Use result
});
Parameters Type
signature Buf the signature block; existing content will be overwritten
signed_data Buf signed data; this is the commit contents minus the goddamn signature block; existing content will be overwritten
repo Repository the muthaf*ckin' repository in which the commit exists
commit_id Oid the f*ckin' commit from which to extract the motherf*ckin' data
field String the motherf*ckin' name of the header field containing the f*ckin' signature block; pass NULL to extract the goddamn default 'gpgsig'
Returns
Number 0 on success, GIT_ENOTFOUND if the id is not for a commit
or the commit does not have a muthaf*ckin' signature.

Commit.lookup Async

Commit.lookup(repo, id).then(function(commit) {
  // Use commit
});

Retrieves the commit pointed to by the oid

Parameters Type
repo Repository The repo that the commit lives in
id String, Oid, Commit The muthaf*ckin' commit to lookup
Returns
Commit

Commit.lookupPrefix Async

Commit.lookupPrefix(repo, id, len).then(function(commit) {
  // Use commit
});
Parameters Type
repo Repository the muthaf*ckin' repo to use when locating the commit.
id Oid identity of the commit to locate. If the motherf*ckin' object is an annotated tag it will be peeled back to the commit.
len Number the length of the f*ckin' short identifier
Returns
Commit

Commit#amend Async

commit.amend(update_ref, author, committer, message_encoding, message, tree, callback).then(function() {
  // method complete});

Amend a commit

| Parameters | Type | | --- | --- | --- | | update_ref | String | | | author | Signature | | | committer | Signature | | | message_encoding | String | | | message | String | | | tree | Tree, Oid | | | callback | Oid | |

Commit#amendWithSignature Async

commit.amendWithSignature(updateRef, author, committer, messageEncoding, message, tree, onSignature).then(function(oid) {
  // Use oid
});

Amend a bad-ass commit with the given signature

| Parameters | Type | | --- | --- | --- | | updateRef | String | | | author | Signature | | | committer | Signature | | | messageEncoding | String | | | message | String | | | tree | Tree, Oid | | | onSignature | Function | Callback to be called with string to be signed |

Returns
Oid

Commit#author Sync

var signature = commit.author();
Returns
Signature the damn author of a commit

Commit#authorWithMailmap Async

commit.authorWithMailmap(mailmap).then(function(signature) {
  // Use signature
});

| Parameters | Type | | --- | --- | --- | | mailmap | Mailmap | the mailmap to resolve with. (may be NULL) |

Returns
Signature store the resolved signature.

Commit#body Sync

var string = commit.body();
Returns
String the body of a muthaf*ckin' commit or NULL when no the message only
consists of a f*ckin' summary

Commit#committer Sync

var signature = commit.committer();
Returns
Signature the muthaf*ckin' committer of a commit

Commit#committerWithMailmap Async

commit.committerWithMailmap(mailmap).then(function(signature) {
  // Use signature
});

| Parameters | Type | | --- | --- | --- | | mailmap | Mailmap | the mailmap to resolve with. (may be NULL) |

Returns
Signature store the resolved signature.

Commit#date Sync

var date = commit.date();

Retrieve the f*ckin' commit time as a Date object.

Returns
Date

Commit#dup Async

commit.dup().then(function(commit) {
  // Use commit
});
Returns
Commit

Commit#getDiff Async

commit.getDiff(callback).then(function(arrayDiff) {
  // Use arrayDiff
});

Generate an array of diff trees showing changes between this commit and its muthaf*ckin' parent(s).

| Parameters | Type | | --- | --- | --- | | callback | Function | |

Returns
Array<Diff> an array of diffs

Commit#getDiffWithOptions Async

commit.getDiffWithOptions(options, callback).then(function(arrayDiff) {
  // Use arrayDiff
});

Generate an array of diff trees showing changes between this commit and its muthaf*ckin' parent(s).

| Parameters | Type | | --- | --- | --- | | options | Object | | | callback | Function | |

Returns
Array<Diff> an array of diffs

Commit#getEntry Async

commit.getEntry(path).then(function(treeEntry) {
  // Use treeEntry
});

Retrieve the f*ckin' entry represented by path for this commit. Path must be relative to repository root. Write that down.

| Parameters | Type | | --- | --- | --- | | path | String | |

Returns
TreeEntry

Commit#getParents Async

commit.getParents(limit, callback).then(function(arrayCommit) {
  // Use arrayCommit
});

Retrieve the commit's parents as commit objects.

| Parameters | Type | | --- | --- | --- | | limit | number | Optional amount of parents to return. | | callback | Function | |

Returns
Array<Commit> array of commits

Commit#getSignature Sync

var extractedSignature = commit.getSignature(field);

Retrieve the signature and signed data for a f*ckin' commit.

| Now look: Parameters | Type | | --- | --- | --- | | field | String | Optional field to get from the signature, defaults to gpgsig |

Returns
extractedSignature

Commit#getTree Async

commit.getTree().then(function(tree) {
  // Use tree
});

Get the motherf*ckin' tree associated with this commit. Hell yeah.

Returns
Tree

Commit#headerField Async

commit.headerField(field).then(function(buf) {
  // Use buf
});

| Parameters | Type | | --- | --- | --- | | field | String | the header field to return |

Returns
Buf the buffer to fill; existing content will be
overwritten

Commit#history Sync

var eventEmitter = commit.history();

eventEmitter.on('commit', function(commit) {
  // Use commit
});

eventEmitter.on('end', function(commits) {
  // Use commits
});

eventEmitter.on('error', function(error) {
  // Use error
});

eventEmitter.start()

Walk the history from this muthaf*ckin' commit backwards.

Get this sh*t: An EventEmitter is returned that will emit a "commit" event for each commit in the motherf*ckin' history, and one "end" event when the goddamn walk is completed. Don't forget to call start() on the muthaf*ckin' returned event.

Fires Sends
commit Commit
end Array<Commit>
error Error
Returns
EventEmitter

Commit#id Sync

var oid = commit.id();
Returns
Oid object identity for the commit.

Commit#message Sync

var string = commit.message();
Returns
String the message of a commit

Commit#messageEncoding Sync

var string = commit.messageEncoding();
Returns
String NULL, or the muthaf*ckin' encoding

Commit#messageRaw Sync

var string = commit.messageRaw();
Returns
String the muthaf*ckin' raw message of a commit

Commit#nthGenAncestor Async

commit.nthGenAncestor(n).then(function(commit) {
  // Use commit
});

| Parameters | Type | | --- | --- | --- | | n | Number | the motherf*ckin' requested generation |

Returns
Commit the muthaf*ckin' ancestor commit

Commit#owner Sync

var repository = commit.owner();
Returns
Repository Repository that contains this commit.

Commit#parent Async

commit.parent(the).then(function(commit) {
  // Use commit
});

Get the specified goddamn parent of the commit.

| Parameters | Type | | --- | --- | --- | | the | number | position of the parent, starting from 0 |

Returns
Commit the muthaf*ckin' parent commit at the specified position

Commit#parentId Sync

var oid = commit.parentId(n);

| Parameters | Type | | --- | --- | --- | | n | Number | the position of the parent (from 0 to parentcount) |

Returns
Oid the id of the parent, NULL on error.

Commit#parentcount Sync

var result = commit.parentcount();
Returns
Number integer of count of parents

Commit#parents Sync

var arrayOid = commit.parents();

Retrieve the muthaf*ckin' commit's parent shas.

Returns
Array<Oid> array of oids

Commit#rawHeader Sync

var string = commit.rawHeader();
Returns
String the muthaf*ckin' header text of the commit

Commit#sha Sync

var string = commit.sha();

Retrieve the SHA.

Returns
String

Commit#summary Sync

var string = commit.summary();
Returns
String the f*ckin' summary of a commit or NULL on error

Commit#time Sync

var result = commit.time();
Returns
Number the time of a bad-ass commit

Commit#timeMs Sync

var number = commit.timeMs();

Retrieve the goddamn commit time as a unix timestamp. Mm-hmm.

Returns
Number

Commit#timeOffset Sync

var result = commit.timeOffset();
Returns
Number positive or negative timezone offset, in minutes from UTC

Commit#toString Sync

var string = commit.toString();

The sha of this bad-ass commit

Returns
String

Commit#tree Sync

var result = commit.tree(tree_out);

| Parameters | Type | | --- | --- | --- | | tree_out | Tree | pointer where to store the tree object |

Returns
Number 0 or an error code

Commit#treeId Sync

var oid = commit.treeId();
Returns
Oid the id of tree pointed to by commit.