joliss/broccoli-kitchen-sink-helpers — pull request #7 by rjackson (2014-04-28 04:56:08+00:00)
Title: Allow hashTree to match after copyRecursivelySync.

This allows comparison of `hashTree` from a source directory against one created with `copyRecursiveSync` to match.

The primary reasons they did not match before was because we included both the initial (root) directory, and every directories `mtime`.

* The root directory was a problem since it is typically `tmp/merged-tree1223.tmp` (or something random), and including the random value in the keys cause it not to match.
* The directory `mtime` is an issue because we are NOT preserving the directory `mtime`'s. We are using `mkdirp` to create all of the directories needed, and the `mtime` for each is `Date.now()` at the time the directory was created (causing a mismatch between the original source and copied source).

Consider the following scenario:

```javascript
var fs = require('fs');
var rimraf = require('rimraf');
var helpers = require('./index');

rimraf.sync('foo');
rimraf.sync('bar');

fs.mkdirSync('foo');
fs.writeFileSync('foo/some-file-1.js', "'blah';");

var originalHash = helpers.hashTree('foo');

setTimeout(function() {
helpers.copyRecursivelySync('foo', 'bar');

var copiedHash = helpers.hashTree('bar');

console.log('originalHash: ' + originalHash);
console.log('copiedHash: ' + copiedHash);
}, 500);
```

Prior to this change the two hashes would not match, after this change they will.