Skip to content

Commit e113080

Browse files
committed
bumped version to 0.0.4
2 parents 2608346 + b758263 commit e113080

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

index.html

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h2>require</h2>
4949

5050
<h2>install</h2>
5151
<p>
52-
<pre class="command">sudo npm install nodegit</pre>
52+
<pre class="command">npm install nodegit</pre>
5353
</p>
5454

5555
<h2>use</h2>
@@ -60,19 +60,29 @@ <h2>use</h2>
6060
// Open a repository for reading
6161
git.repo( '.git', function( err, repo ) {
6262
// Success is always 0, failure is always an error string
63-
if( err ) { throw err; }
63+
if( err ) {
64+
throw new Error( err );
65+
}
66+
6467
// Use the master branch
6568
repo.branch( 'master', function( err, branch ) {
66-
if( err ) { throw err; }
69+
if( err ) {
70+
throw new Error( err );
71+
}
72+
6773
// Iterate over the revision history
68-
branch.history.each( function( i, commit ) {
74+
var history = branch.history();
75+
history.on( 'commit', function( index, commit ) {
6976
// Print out `git log` emulation
7077
console.log( 'commit ' + commit.sha );
78+
console.log( '\n' );
7179
console.log( commit.author.name + '<' + commit.author.email + '>' );
7280
console.log( commit.time );
73-
console.log( '\n' );
7481
console.log( commit.message );
75-
console.log( '\n' );
82+
});
83+
84+
history.on( 'end', function() {
85+
// Continue
7686
});
7787
});
7888
});
@@ -86,12 +96,18 @@ <h2>use</h2>
8696
// Open a repository for reading
8797
git.repo( '.git', function( err, repo ) {
8898
// Success is always 0, failure is always an error string
89-
if( err ) { throw err; }
99+
if( err ) {
100+
throw new Error( err );
101+
}
102+
90103
// Use the master branch
91104
repo.branch( 'master', function( err, branch ) {
92-
if( err ) { throw err; }
105+
if( err ) {
106+
throw new Error( err );
107+
}
108+
93109
// Iterate over the revision history
94-
branch.tree().each( function( i, entry ) {
110+
branch.tree().walk(function( i, entry ) {
95111
console.log( entry.name );
96112
console.log( entry.content );
97113
});

0 commit comments

Comments
 (0)