Comparing version 2.12.0 to 2.13.0
@@ -26,4 +26,23 @@ var fs = require('fs'); | ||
var commit = fs.readFileSync(path.join(dir, '.git', 'refs', 'heads', branch), 'utf-8').trim(); | ||
var commit = _parseCommitHashFromRef(dir, branch); | ||
return { git_commit: commit, git_branch: branch }; | ||
}; | ||
function _parseCommitHashFromRef(dir, branch) { | ||
var ref = path.join(dir, '.git', 'refs', 'heads', branch); | ||
if (fs.existsSync(ref)) { | ||
return fs.readFileSync(ref, 'utf-8').trim(); | ||
} else { | ||
// ref does not exist; get it from packed-refs | ||
var commit = ''; | ||
var packedRefs = path.join(dir, '.git', 'packed-refs'); | ||
var packedRefsText = fs.readFileSync(packedRefs, 'utf-8'); | ||
packedRefsText.split('\n').forEach(function (line) { | ||
if (line.match('refs/heads/'+branch)) { | ||
commit = line.split(' ')[0]; | ||
} | ||
}); | ||
return commit; | ||
} | ||
} |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"bugs": { | ||
@@ -11,0 +11,0 @@ "url": "https://github.com/nickmerwin/node-coveralls/issues" |
@@ -1,2 +0,2 @@ | ||
#node-coveralls | ||
# node-coveralls | ||
@@ -10,3 +10,3 @@ [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
##Installation: | ||
## Installation: | ||
Add the latest version of `coveralls` to your package.json: | ||
@@ -22,3 +22,3 @@ ``` | ||
##Usage: | ||
## Usage: | ||
@@ -25,0 +25,0 @@ This script ( `bin/coveralls.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://mochajs.org/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to coveralls.io to report your code coverage there. |
Sorry, the diff of this file is not supported yet
72964
26
1715
154