function assertContentsMatch(dir, url, branch) {
  return mkdtemp()
    .then((root) => {
      const clone = path.join(root, 'repo');
      const options = {git: 'git', remote: 'origin', depth: 1};
      return Git.clone(url, clone, branch, options);
    })
    .then((git) => {
      const comparison = compare(dir, git.cwd, {excludeFilter: '.git'});
      if (comparison.same) {
        return true;
      } else {
        const message = comparison.diffSet
          .map((entry) => {
            const state = {
              equal: '==',
              left: '->',
              right: '<-',
              distinct: '<>',
            }[entry.state];
            const name1 = entry.name1 ? entry.name1 : '<none>';
            const name2 = entry.name2 ? entry.name2 : '<none>';

            return [name1, state, name2].join(' ');
          })
          .join('\n');
        throw new Error('Directories do not match:\n' + message);
      }
    });
}
@param {string} dir The dir.
@param {string} url The url.
@param {string} branch The branch.
@return {Promise} A promise.