@@ -30,26 +30,19 @@ $ npm install nodegit
3030
3131### Mac OS X/Linux/Unix ###
3232
33- #### Install ` nodegit ` by cloning source from GitHub and running the ` configure ` , ` make ` , and ` make install ` commands: ####
34- \* Note: ` nodegit ` assumes your library path exists at ` ~/.node_libraries ` you can change this by specifying a new lib path\*
33+ #### Install ` nodegit ` by cloning source from GitHub and running ` node install ` : ####
3534
3635```` bash
3736$ git clone git://github.com/tbranyen/nodegit.git
3837$ cd nodegit
39-
40- $ ./configure
41- $ make
42- $ make install
43-
44- $ make install NODE_LIB_PATH=/path/to/your/libraries
38+ $ node install
4539````
4640
4741\* Updating to a new version\*
4842
4943```` bash
50- $ make update
51-
52- $ make update NODE_LIB_PATH=/path/to/your/libraries
44+ $ git pull
45+ $ node install
5346````
5447
5548### Windows via Cygwin ###
@@ -70,22 +63,22 @@ API Example Usage
7063var git = require (" nodegit" );
7164
7265// Read a repository
73- git .repo (" .git" , function (err , repo ) {
66+ git .repo (' .git' , function (err , repo ) {
7467 // Success is always 0, failure is always an error string
75- if (err ) { throw err ; }
68+ if (error ) { throw error ; }
7669
7770 // Use the master branch
78- repo .branch (" master" , function (err , branch ) {
79- if (err ) { throw err ; }
71+ repo .branch (' master' , function (err , branch ) {
72+ if (error ) { throw error ; }
8073
8174 // Iterate over the revision history
8275 var history = branch .history ();
8376
8477 // Commit event emits commit object
85- history .on (" commit" , function (commit ) {
78+ history .on (' commit' , function (commit ) {
8679 // Print out `git log` emulation
87- console .log (" commit " + commit .sha );
88- console .log (commit .author .name + " < " + commit .author .email + " > " );
80+ console .log (' commit ' + commit .sha );
81+ console .log (commit .author .name + ' < ' + commit .author .email + ' > ' );
8982 console .log (commit .time );
9083 console .log (" \n " );
9184 console .log (commit .message );
@@ -98,81 +91,81 @@ git.repo(".git", function(err, repo) {
9891#### Raw API ####
9992
10093```` javascript
101- var git = require ( ' nodegit' ).raw ;
94+ var git = require (' nodegit' ).raw ;
10295
10396// Create instance of Repo constructor
10497var repo = new git.Repo ();
10598
10699// Read a repository
107- repo .open ( ' .git' , function ( err ) {
100+ repo .open (' .git' , function (error ) {
108101 // Err is an integer, success is 0, use strError for string representation
109- if ( err ) {
102+ if (error ) {
110103 var error = new git.Error ();
111- throw error .strError ( err );
104+ throw error .strError (error );
112105 }
113106
114107 // Create instance of Ref constructor with this repository
115- var ref = new git.Ref ( repo );
108+ var ref = new git.Ref (repo);
116109
117110 // Find the master branch
118- repo .lookupRef ( ref, ' /refs/heads/master' , function ( err ) {
119- if ( err ) {
111+ repo .lookupRef (ref, ' /refs/heads/master' , function (err ) {
112+ if (error ) {
120113 var error = new git.Error ();
121- throw error .strError ( err );
114+ throw error .strError (err);
122115 }
123116
124117 // Create instance of Commit constructor with this repository
125- var commit = new git.Commit ( repo ),
118+ var commit = new git.Commit (repo),
126119 // Create instance of Oid constructor
127120 oid = new git.Oid ();
128121
129122 // Set the oid constructor internal reference to this branch reference
130- ref .oid ( oid );
123+ ref .oid (oid);
131124
132125 // Lookup the commit for this oid
133- commit .lookup ( oid, function () {
134- if ( err ) {
126+ commit .lookup (oid, function (err ) {
127+ if (err) {
135128 var error = new git.Error ();
136129 throw error .strError ( err );
137130 }
138131
139132 // Create instance of RevWalk constructor with this repository
140- var revwalk = new git.RevWalk ( repo );
133+ var revwalk = new git.RevWalk (repo);
141134
142135 // Push the commit as the start to walk
143- revwalk .push ( commit );
136+ revwalk .push (commit);
144137
145138 // Recursive walk
146139 function walk () {
147140 // Each revision walk iteration yields a commit
148- var revisionCommit = new git.Commit ( repo );
141+ var revisionCommit = new git.Commit (repo);
149142
150- revwalk .next ( revisionCommit, function ( err ) {
143+ revwalk .next ( revisionCommit, function (err ) {
151144 // Finish recursion once no more revision commits are left
152- if ( err ) { return ; }
145+ if (err) { return ; }
153146
154147 // Create instance of Oid for sha
155148 var oid = new git.Oid ();
156149
157150 // Set oid to the revision commit
158- revisionCommit .id ( oid );
151+ revisionCommit .id (oid);
159152
160153 // Create instance of Sig for author
161154 var author = new git.Sig ();
162155
163156 // Set the author to the revision commit author
164- revisionCommit .author ( author );
157+ revisionCommit .author (author);
165158
166159 // Convert timestamp to milliseconds and set new Date object
167160 var time = new Date ( revisionCommit .time () * 1000 );
168161
169162 // Print out `git log` emulation
170- console .log ( oid .toString ( 40 ) );
171- console .log ( author .name () + ' <' + author .email () + ' >' );
172- console .log ( time );
173- console .log ( ' \n ' );
174- console .log ( revisionCommit .message () );
175- console .log ( ' \n ' );
163+ console .log (oid .toString ( 40 ));
164+ console .log (author .name () + ' <' + author .email () + ' >' );
165+ console .log (time);
166+ console .log (' \n ' );
167+ console .log (revisionCommit .message ());
168+ console .log (' \n ' );
176169
177170 // Recurse!
178171 walk ();
0 commit comments