Skip to content

Commit 4318b85

Browse files
committed
Code cleanup - better variable naming
1 parent 9cdc151 commit 4318b85

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/git.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var exec = require('child_process').exec
55
var afterAll = require('after-all-results')
66
var 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

Comments
 (0)