Skip to content

Commit b758263

Browse files
committed
Corrected index.html
1 parent ccc9817 commit b758263

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

index.html

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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().on( 'commit', function( 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,10 +96,16 @@ <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
94110
branch.tree().walk(function( i, entry ) {
95111
console.log( entry.name );

0 commit comments

Comments
 (0)