-
Notifications
You must be signed in to change notification settings - Fork 699
Expand file tree
/
Copy pathconvenience-commit.js
More file actions
43 lines (33 loc) · 1.08 KB
/
convenience-commit.js
File metadata and controls
43 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var git = require( '../' );
git.repo( '../.git', function( err, repo ) {
if( err ) { throw new Error( err ); }
repo.commit( '59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5', function( err, commit ) {
if( err ) { throw new Error( err ); }
var history = commit.history();
history.on( 'commit', function() {
// console.log(arguments);
});
history.on( 'end', function( commits ) {
// Read first commit tree
var tree = commits[0].tree();
// Synchronous
tree.walk().on('entry', function( i, entry ) {
console.log( entry.content );
return false;
});
// Asynchronous - not yet implemented
//tree.walk().on( 'entry', function( err, i, entry ) {
// console.log( entry );
//});
});
});
//repo.branch( 'master', function( err, branch ) {
// if( err ) { throw new Error( err ); }
// var history = branch.history();
// console.log( history );
// //branch.tree().each( function( i, entry ) {
// // console.log( entry.name );
// // console.log( entry.contents );
// //});
//});
});