Install
# from source, no dependencies beyond a C compiler
make && sudo make install
# or drop the single binary somewhere on PATH
install -m 755 build/treecmp /usr/local/bin/
Usage
treecmp ./release-1.4 ./release-1.5
~ bin/loader content differs (412 B)
+ share/locale/pt_BR/ only in ./release-1.5
- doc/legacy.txt only in ./release-1.4
= 1284 entries identical
Exit code is 0 when the trees match and 1 when they
do not, so it drops into a build pipeline without extra glue.
Options
| Flag | Effect |
|---|---|
| -q | Print only the summary line. |
| -x PATTERN | Exclude paths matching a glob. Repeatable. |
| --hash=sha256 | Compare file contents by digest instead of byte-by-byte. |
| --follow | Follow symlinks. Off by default, and cycles are detected. |
| -j N | Hash files on N threads. Defaults to the core count. |
Why not diff -r
diff -r reports differences line by line, which is the wrong
granularity when you only need to know whether a build output changed.
On large trees it also spends most of its time formatting output nobody reads.
treecmp stops at the first differing block of a file and moves on.
On a 40k-file tree the difference is roughly 90 seconds versus 3.
Status
Maintained, but deliberately finished. Bug fixes and portability patches are welcome; new features almost certainly are not. The tool does one thing.