<commit_before>/**/
var git = require( '../' );

var _Repo = function( path, callback ) {
  // Public namespace
  var self = {};

  // Private internal use variables
  var _commits = [],
      _error = git.error();

  function error( err ) {
    if(err !== 0) {
      return _error.error.strError( err );
    }

    return 0;
  }


  // Internal reference to a Git repository
  self.repo = new git.git2.Repo();

  // Find all commits under a given repository and optionally filtered further by a Ref
  //self.commits = function( obj ) {
  //  obj = obj || "HEAD";

  //  if( commits.length ) {
  //    return commits;
  //  }
  //  else {
  //    
  //  }
  //};

  // Find a single commit
  self.commit = function( sha, callback ) {
    var oid = new git.git2.Oid(),
        commit = new git.git2.Commit();

    oid.mkstr( sha );

    commit.lookup( self.repo, oid, function() {
      var args = Array.prototype.slice.call( arguments );
      args[0] = error( args[0] );

      callback && callback.apply( commit, (args.push( commit ), args) );
    });
  };

  self.find = function( name, callback ) {
    var ref = new git.git2.Ref();
    self.repo.lookupRef( ref, name, function() {
      var args = Array.prototype.slice.call( arguments );
      args[0] = error( args[0] );

      callback && callback.apply( ref, (args.push( git.ref(ref) ), args) );
    });
  };

  self.init = function( path, is_bare, callback ) {
    self.repo.init( path, is_bare, function() {
      var args = Array.prototype.slice.call( arguments );
      args[0] = error( args[0] );

      callback && callback.apply( self, (args.push( self ), args) );
    });

    return self;
  };

  self.free = function() { 
    self.repo.free();
    delete self.repo;
  };

  // Constructor use
  if( path && callback ) {
    self.repo.open( path, function() {
      var args = Array.prototype.slice.call( arguments );
      args[0] = error( args[0] );

      callback && callback.apply( self, (args.push( self ), args) );
    });
  }
  else if( path ) {
    self.repo.open( path );
  }

  return self;
};

exports.repo = _Repo;<commit_msg>Updated repo lib to fix code conventions Closes #7 Closes #6<commit_after>/**/
var git = require( '../' );

var _Repo = function( path, callback ) {
  // Public namespace
  var self = {};

  // Private internal use variables
  var _commits = [],
      _error = git.error();

  function error( err ) {
    if(err !== 0) {
      return _error.error.strError( err );
    }

    return 0;
  }


  // Internal reference to a Git repository
  self.repo = new git.git2.Repo();

  // Find all commits under a given repository and optionally filtered further by a Ref
  //self.commits = function( obj ) {
  //  obj = obj || "HEAD";

  //  if( commits.length ) {
  //    return commits;
  //  }
  //  else {
  //    
  //  }
  //};

  // Find a single commit
  self.commit = function( sha, callback ) {
    var oid = new git.git2.Oid(),
        commit = new git.git2.Commit();

    if(!callback) { return; }

    oid.mkstr( sha );

    commit.lookup( self.repo, oid, function() {
      var args = Array.prototype.slice.call( arguments );

      args[0] = error( args[0] );

      callback.apply( commit, args.concat( commit ) );
    });
  };

  self.find = function( name, callback ) {
    var ref = new git.git2.Ref();
    
    if(!callback) { return; }

    self.repo.lookupRef( ref, name, function() {
      var args = Array.prototype.slice.call( arguments ),
          ref = git.ref( ref );

      args[0] = error( args[0] );

      callback.apply( ref, args.concat( ref ) );
    });
  };

  self.init = function( path, is_bare, callback ) {
    if(!callback) { return; }

    self.repo.init( path, is_bare, function() {
      var args = Array.prototype.slice.call( arguments );

      args[0] = error( args[0] );

      callback.apply( self, args.concat( self ) );
    });

    return self;
  };

  self.free = function() { 
    self.repo.free();
    delete self.repo;
  };

  // Constructor use
  if( path && callback ) {
    if(!callback) { return; }

    self.repo.open( path, function() {
      var args = Array.prototype.slice.call( arguments );

      args[0] = error( args[0] );

      callback.apply( self, args.concat( self ) );
    });
  }
  else if( path ) {
    self.repo.open( path );
  }

  return self;
};

exports.repo = _Repo;
{'fraction_non_alphanumeric': 0.16294591484464901, 'fraction_numerical': 0.006904487917146145, 'mean_word_length': 2.226429101707498, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2036136', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1416, 'n_words': 378}