<commit_before>var When = require('when');
var fs = require('fs');
var path = require('path');
var childProcess = require('child_process');

var JamPath = "";

exports.getJamPath = function(){
	if(JamPath != ""){
		return When(JamPath);
	}
	else{
		return exec('git rev-parse --git-dir')
		.then(function(res){
			var jamPath = path.join(path.join.apply(this,res.trim().split('/')),'jam');
			return jamPath;
		});
	}
}

exports.config = function(param,value){
	return exec('git config "' + param + '" "' + value + '"');
}

function exec(command){
	var defered = When.defer();
	childProcess.exec(command,function(err,stdout){<commit_msg>Added utility to get tracked filtered files<commit_after>var When = require('when');
var fs = require('fs');
var path = require('path');
var childProcess = require('child_process');

var JamPath = "";

exports.getJamPath = function(){
	if(JamPath != ""){
		return When(JamPath);
	}
	else{
		return exec('git rev-parse --git-dir')
		.then(function(res){
			var jamPath = path.join(path.join.apply(this,res.trim().split('/')),'jam');
			return jamPath;
		});
	}
}

exports.config = function(param,value){
	return exec('git config "' + param + '" "' + value + '"');
}

exports.lsFiles = function(){
	return exec('git ls-tree --name-only --full-tree -z -r HEAD')
	.then(function(res){
		return res.split('\0');
	});
};

exports.lsFilteredFiles = function(){
	return exports.lsFiles()
	.then(function(res){
		return exec('git check-attr -z filter ' + res.join(' '));
	})
	.then(function(res){
		var files = [];
		var words = res.split('\0');
		for(var i = 0; i< words.length;i += 3){
			if(words[i+2] == 'jam'){
				files.push(words[i]);
			}
		}
		return files;
	});
}

function exec(command){
	var defered = When.defer();
	childProcess.exec(command,function(err,stdout){
{'fraction_non_alphanumeric': 0.20454545454545456, 'fraction_numerical': 0.002771618625277162, 'mean_word_length': 4.340236686390533, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4511000', 'n_tokens_mistral': 671, 'n_tokens_neox': 626, 'n_words': 132}