<commit_before>const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const ps = require('./projectSettings');
const execSync = require('child_process').execSync;
const ninPackageJson = require('../../package.json');

function getProjectMetadata(projectPath) {
  return {
    projectSettings: ps.load(projectPath),
    projectVersion: execSync('git rev-parse HEAD'),
    projectOrigin: execSync('git config --get remote.origin.url'),
  };
}

function getNinMetadata() {
  let sha1, origin;
  try {
    sha1 = execSync(`cd ${__dirname} && git rev-parse HEAD`);
    origin = execSync(`cd ${__dirname} && git config --get remote.origin.url`);
  } catch (e) {
  }
  return {
    name: ninPackageJson.name,
    version: ninPackageJson.version,
    sha1,
    origin,
  };
}

function findProjectRoot(currentPath) {
  let up = '';
  let base = '';<commit_msg>Suppress error output from git commands<commit_after>const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const ps = require('./projectSettings');
const execSync = require('child_process').execSync;
const ninPackageJson = require('../../package.json');

function getProjectMetadata(projectPath) {
  return {
    projectSettings: ps.load(projectPath),
    projectVersion: execSync('git rev-parse HEAD'),
    projectOrigin: execSync('git config --get remote.origin.url'),
  };
}

function getNinMetadata() {
  let sha1, origin;
  try {
    sha1 = execSync('git rev-parse HEAD', {
      cwd: __dirname,
      stdio: ['ignore', 'pipe', 'ignore']
    });
    origin = execSync('git config --get remote.origin.url', {
      cwd: __dirname,
      stdio: ['ignore', 'pipe', 'ignore']
    });
  } catch (e) {
    sha1 = 'N/A';
    origin = 'npm';
  }
  return {
    name: ninPackageJson.name,
    version: ninPackageJson.version,
    sha1,
    origin,
  };
}

function findProjectRoot(currentPath) {
  let up = '';
  let base = '';
{'fraction_non_alphanumeric': 0.15911431513903193, 'fraction_numerical': 0.003604531410916581, 'mean_word_length': 3.727493917274939, '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': '3177616', 'n_tokens_mistral': 606, 'n_tokens_neox': 605, 'n_words': 149}