Guest User

Untitled

a guest
Jan 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. var git = require( 'nodegit' );
  2.  
  3. // Read a repository
  4. git.repo( '.git', function( err, repo ) {
  5. // Success is always 0, failure is always an error string
  6. if( err ) { throw err; }
  7.  
  8. // Use the master branch
  9. repo.branch( 'master', function( err, branch ) {
  10. if( err ) { throw err; }
  11.  
  12. // Iterate over the revision history
  13. var history = branch.history();
  14.  
  15. history.on( 'commit', function( err, commit ) {
  16. // Print out `git log` emulation
  17. console.log( 'commit ' + commit.sha );
  18. console.log( commit.author.name + '<' + commit.author.email + '>' );
  19. console.log( commit.time );
  20. console.log( '\n' );
  21. console.log( commit.message );
  22. console.log( '\n' );
  23. });
  24.  
  25. history.on( 'end', function( err ) {
  26.  
  27. });
  28. });
  29. });
Add Comment
Please, Sign In to add comment