Skip to content

Commit 9a89c82

Browse files
committed
add gitSignature to commit prototype
1 parent 716ea86 commit 9a89c82

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/commit.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var Commit = NodeGit.Commit;
44
var LookupWrapper = NodeGit.Utils.lookupWrapper;
55

66
var _amend = Commit.prototype.amend;
7+
78
/**
89
* Retrieves the commit pointed to by the oid
910
* @async
@@ -162,6 +163,23 @@ Commit.prototype.getParents = function(limit, callback) {
162163
}, callback);
163164
};
164165

166+
/**
167+
* @typedef extractedSignature
168+
* @type {Object}
169+
* @property {String} signature the signature of the commit
170+
* @property {String} signedData the extracted signed data
171+
*/
172+
173+
/**
174+
* Retrieve the signature and signed data for a commit.
175+
* @param {String} field Optional field to get from the signature,
176+
* defaults to gpgsig
177+
* @return {extractedSignature}
178+
*/
179+
Commit.prototype.getSignature = function(field) {
180+
return Commit.extractSignature(this.repo, this.id(), field);
181+
};
182+
165183
/**
166184
* Get the tree associated with this commit.
167185
*

0 commit comments

Comments
 (0)