Code coverage report for ggit/src/is-file-tracked.js

Statements: 100% (11 / 11)      Branches: 100% (0 / 0)      Functions: 100% (1 / 1)      Lines: 100% (11 / 11)      Ignored: none     

All files » ggit/src/ » is-file-tracked.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171 1 1 1 1   1 5 5 5 5       1    
require('lazy-ass');
var check = require('check-more-types');
var exec = require('./exec');
var path = require('path');
var d3h = require('d3-helpers');
 
function isFileTracked(filename) {
  la(check.unemptyString(filename), 'missing filename');
  var fullPath = path.resolve(filename);
  var cmd = 'git ls-files --error-unmatch ' + fullPath;
  return exec(cmd)
    .then(d3h.yes, d3h.no);
}
 
module.exports = check.defend(isFileTracked,
  check.unemptyString, 'expected filename');