lib/helpers/git/git/compare-commits.js
function compareCommits(options) {
  assert("You MUST include 'project' in the options passed to compareCommits." +
    "It should be the path to the project's git root.", options.project);
  assert("You MUST include 'base' in the options passed to compareCommits. " +
    "It should be either a branch name or tag name.", options.base);
  assert("You MUST include 'head' in the options passed to compareCommits. " +
    "It should be either a branch name or tag name.", options.head);
  assert("Branch or Tag names passed to compareCommit via 'options.head' must be strings.",
    typeof options.head === 'string');
  assert("Branch or Tag names passed to compareCommit via 'options.base' must be strings.",
    typeof options.base === 'string');

  return getRepository(options.project)
    .then(function(repository) {
      return RSVP.hash({
        head: getReference(repository, options.head),
        base: getReference(repository, options.base),
        repository: repository
      });
    })
    .then(function(references) {
      return RSVP.hash({
        head: getTargetCommit(references.repository, references.head),
        base: getTargetCommit(references.repository, references.base),
        repository: references.repository
      });
    })
    .then(function(heads) {
      return walkCommits(heads.repository, heads.head, heads.base);
    });
}
function compareCommits(options) {
  assert("You MUST include 'project' in the options passed to compareCommits." +
    "It should be the path to the project's git root.", options.project);
  assert("You MUST include 'base' in the options passed to compareCommits. " +
    "It should be either a branch name or tag name.", options.base);
  assert("You MUST include 'head' in the options passed to compareCommits. " +
    "It should be either a branch name or tag name.", options.head);
  assert("Branch or Tag names passed to compareCommit via 'options.head' must be strings.",
    typeof options.head === 'string');
  assert("Branch or Tag names passed to compareCommit via 'options.base' must be strings.",
    typeof options.base === 'string');

  return getRepository(options.project)
    .then(function(repository) {
      return RSVP.hash({
        head: getReference(repository, options.head),
        base: getReference(repository, options.base),
        repository: repository
      });
    })
    .then(function(references) {
      return RSVP.hash({
        head: getTargetCommit(references.repository, references.head),
        base: getTargetCommit(references.repository, references.base),
        repository: references.repository
      });
    })
    .then(function(heads) {
      return walkCommits(heads.repository, heads.head, heads.base);
    });
}
!
@method compareCommits

@param {String} projectRoot the path to the project's git root
@param {String} leading a branch or tag name ahead of trailing
@param {String} trailing a branch or tag name behind leading
@returns {Array} the array of commits from leading to trailing, newest first