@@ -5,8 +5,8 @@ var exec = require('child_process').exec
55var afterAll = require ( 'after-all-results' )
66var debug = require ( './debug' )
77
8- exports . check = function ( dir , cb ) {
9- debug ( 'processing git project' , dir )
8+ exports . check = function ( repo , cb ) {
9+ debug ( 'processing git project' , repo )
1010
1111 var next = afterAll ( function ( err , results ) {
1212 if ( err ) return cb ( err )
@@ -23,13 +23,13 @@ exports.check = function (dir, cb) {
2323 } )
2424 } )
2525
26- branch ( dir , next ( ) )
27- ahead ( dir , next ( ) )
28- status ( dir , next ( ) )
26+ branch ( repo , next ( ) )
27+ ahead ( repo , next ( ) )
28+ status ( repo , next ( ) )
2929}
3030
31- var status = function ( cwd , cb ) {
32- exec ( 'git status -s' , { cwd : cwd } , function ( err , stdout , stderr ) {
31+ var status = function ( repo , cb ) {
32+ exec ( 'git status -s' , { cwd : repo } , function ( err , stdout , stderr ) {
3333 if ( err ) return cb ( err )
3434 var status = { dirty : 0 , untracked : 0 }
3535 stdout . trim ( ) . split ( os . EOL ) . forEach ( function ( file ) {
@@ -40,17 +40,17 @@ var status = function (cwd, cb) {
4040 } )
4141}
4242
43- var branch = function ( cwd , cb ) {
44- exec ( 'cat .git/HEAD' , { cwd : cwd } , function ( err , stdout , stderr ) {
43+ var branch = function ( repo , cb ) {
44+ exec ( 'cat .git/HEAD' , { cwd : repo } , function ( err , stdout , stderr ) {
4545 if ( err ) return cb ( err )
4646 stdout = stdout . trim ( )
4747 var branch = stdout . indexOf ( 'ref:' ) === 0 ? stdout . substr ( 16 ) : stdout
4848 cb ( null , branch )
4949 } )
5050}
5151
52- var ahead = function ( cwd , cb ) {
53- exec ( 'git rev-list HEAD --not --remotes' , { cwd : cwd } , function ( err , stdout , stderr ) {
52+ var ahead = function ( repo , cb ) {
53+ exec ( 'git rev-list HEAD --not --remotes' , { cwd : repo } , function ( err , stdout , stderr ) {
5454 if ( err ) return cb ( null , NaN ) // depending on the state of the git repo, the command might return non-0 exit code
5555 stdout = stdout . trim ( )
5656 cb ( null , ! stdout ? 0 : parseInt ( stdout . split ( os . EOL ) . length , 10 ) )
0 commit comments