<commit_before>'use strict';

const gulp = require('gulp')
const gutil = require('gulp-util')
const exec = require('child_process').exec

function runCommand(cmd) {
  return new Promise((resolve, reject) => {
    if (!cmd) {
      reject(new Error('No command specified.'))
    }

    exec(cmd, function (err, stdout, stderr) {
      if (err) {
        reject(err)
      } else if (stderr) {
        reject(stderr)
      } else {
        resolve(stdout)
      }
    })
  })
}

function getFileChanges(path) {
  if (!path) {
    throw new Error('No path given')
  }

  let cmd = `git diff origin/master -- ${path}`

  return runCommand(cmd)
}

function verifyChangelogChanges(lines) {
  return new Promise((resolve, reject) => {
    if (!lines) {
      reject(new Error('No CHANGELOG.md update'))
    } else {
      resolve(lines);
    }
  })
}

gulp.task('changelog', (done) => {
  getFileChanges('CHANGELOG.md')
    .then(verifyChangelogChanges)
    .then(() => {
      done()
    })
    .catch((err) => {
      gutil.log(gutil.colors.red(err))
      done(err)
    })
})

module.exports = {
  runCommand: runCommand,
  getFileChanges: getFileChanges,
  verifyChangelogChanges: verifyChangelogChanges
}
<commit_msg>use already fetched master for comparison<commit_after>'use strict';

const gulp = require('gulp')
const gutil = require('gulp-util')
const exec = require('child_process').exec

function runCommand(cmd) {
  return new Promise((resolve, reject) => {
    if (!cmd) {
      reject(new Error('No command specified.'))
    }

    exec(cmd, function (err, stdout, stderr) {
      if (err) {
        reject(err)
      } else if (stderr) {
        reject(stderr)
      } else {
        resolve(stdout)
      }
    })
  })
}

function getFileChanges(path) {
  if (!path) {
    throw new Error('No path given')
  }

  let cmd = `git diff master -- ${path}`

  return runCommand(cmd)
}

function verifyChangelogChanges(lines) {
  return new Promise((resolve, reject) => {
    if (!lines) {
      reject(new Error('No CHANGELOG.md update'))
    } else {
      resolve(lines);
    }
  })
}

gulp.task('changelog', (done) => {
  getFileChanges('CHANGELOG.md')
    .then(verifyChangelogChanges)
    .then(() => {
      done()
    })
    .catch((err) => {
      gutil.log(gutil.colors.red(err))
      done(err)
    })
})

module.exports = {
  runCommand: runCommand,
  getFileChanges: getFileChanges,
  verifyChangelogChanges: verifyChangelogChanges
}

{'fraction_non_alphanumeric': 0.15055079559363524, 'fraction_numerical': 0.0, 'mean_word_length': 2.873617693522907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4528969', 'n_tokens_mistral': 821, 'n_tokens_neox': 820, 'n_words': 173}