@@ -4,27 +4,31 @@ var git = require('../'),
44
55/**
66 * Retrieve the SHA.
7+ * @return {String }
78 */
89Commit . prototype . sha = function ( ) {
910 return this . oid ( ) . sha ( ) ;
1011} ;
1112
1213/**
1314 * Retrieve the commit time as a unix timestamp.
15+ * @return {Number }
1416 */
1517Commit . prototype . timeMs = function ( ) {
1618 return this . time ( ) * 1000 ;
1719} ;
1820
1921/**
2022 * Retrieve the commit time as a Date object.
23+ * @return {Date }
2124 */
2225Commit . prototype . date = function ( ) {
2326 return new Date ( this . timeMs ( ) ) ;
2427} ;
2528
2629/**
2730 * Get the tree associated with this commit.
31+ * @return {Tree }
2832 */
2933Commit . prototype . getTree = function ( callback ) {
3034 this . repo . getTree ( this . treeId ( ) , callback ) ;
@@ -35,14 +39,10 @@ Commit.prototype.getTree = function(callback) {
3539 * Path must be relative to repository root.
3640 *
3741 * @param {String } path
38- * @param {Commit~fileCallback } callback
42+ * @param {Function } callback
43+ * @return {TreeEntry }
3944 */
4045Commit . prototype . getEntry = function ( path , callback ) {
41- /**
42- * @callback Commit~fileCallback Callback executed on file retrieval.
43- * @param {GitError|null } error An Error or null if successful.
44- * @param {Entry|null } file Retrieved file entry.
45- */
4646 this . getTree ( function ( error , tree ) {
4747 if ( error ) return callback ( error ) ;
4848
@@ -54,11 +54,12 @@ Commit.prototype.getEntry = function(path, callback) {
5454 * Walk the history from this commit backwards.
5555 * An EventEmitter is returned that will emit a 'commit' event for each
5656 * commit in the history, and one 'end' event when the walk is completed.
57+ * Don't forget to call `start()` on the returned event.
5758 *
5859 * @fires Commit#commit
5960 * @fires Commit#end
6061 *
61- * @return {EventEmitter } historyWalkEmitter
62+ * @return {EventEmitter }
6263 */
6364Commit . prototype . history = function ( ) {
6465 var event = new events . EventEmitter ( ) ;
@@ -71,25 +72,9 @@ Commit.prototype.history = function() {
7172 if ( error ) return event . emit ( 'error' , error ) ;
7273
7374 if ( ! commit ) {
74- /**
75- * End event.
76- *
77- * @event Commit#end
78- *
79- * @param {GitError|null } error An error object if there was an issue, null otherwise.
80- * @param {Commit[] } commits The commits.
81- */
8275 event . emit ( 'end' , commits ) ;
8376 return ;
8477 }
85- /**
86- * Commit event.
87- *
88- * @event Commit#commit
89- *
90- * @param {GitError|null } error An error object if there was an issue, null otherwise.
91- * @param {Commit } commit The commit.
92- */
9378 event . emit ( 'commit' , commit ) ;
9479 commits . push ( commit ) ;
9580 } ) ;
@@ -100,14 +85,10 @@ Commit.prototype.history = function() {
10085/**
10186 * Retrieve the commit's parents -- as commit objects.
10287 *
103- * @param {Commit~parentsCallback } callback
88+ * @param {Function } callback
89+ * @return {[Commit] } array of commits
10490 */
10591Commit . prototype . getParents = function ( callback ) {
106- /**
107- * @callback Commit~parentsCallback Callback executed on parents retrieval.
108- * @param {GitError|null } error An Error or null if successful.
109- * @param {Commit[]|null } parents Commit's parent(s).
110- */
11192 var self = this ;
11293 function processParents ( commit , n , acc , callback ) {
11394 if ( n < 0 ) return callback ( null , acc ) ;
@@ -124,7 +105,8 @@ Commit.prototype.getParents = function(callback) {
124105/**
125106 * Retrieve the commit's parent shas.
126107 *
127- * @param {Commit~parentsCallback } callback
108+ * @param {Function } callback
109+ * @return {[Oid] } array of oids
128110 */
129111Commit . prototype . parents = function ( ) {
130112 var result = [ ] ;
@@ -138,14 +120,10 @@ Commit.prototype.parents = function() {
138120 * Generate an array of diff trees showing changes between this commit
139121 * and its parent(s).
140122 *
141- * @param {Commit~parentsDiffTreesCallback } callback
123+ * @param {Function } callback
124+ * @return {[DiffList] } an array of difflists
142125 */
143126Commit . prototype . getDiff = function ( callback ) {
144- /**
145- * @callback Commit~parentsDiffTreesCallback Callback executed on diff trees retrieval.
146- * @param {GitError|null } error An Error or null if successful.
147- * @param {DiffList[]|null } diffLists Array of DiffTrees showing changes between this commit and its parent(s)
148- */
149127 var self = this ;
150128 self . getParents ( function commitParents ( error , parents ) {
151129 if ( error ) return callback ( error ) ;
@@ -172,6 +150,10 @@ Commit.prototype.getDiff = function(callback) {
172150 } ) ;
173151} ;
174152
153+ /**
154+ * The sha of this commit
155+ * @return {String }
156+ */
175157Commit . prototype . toString = function ( ) {
176158 return this . sha ( ) ;
177159} ;
0 commit comments