https://github.com/qookei/dir-diff
Directory diff utility
https://github.com/qookei/dir-diff
cli diff tool utility
Last synced: about 1 year ago
JSON representation
Directory diff utility
- Host: GitHub
- URL: https://github.com/qookei/dir-diff
- Owner: qookei
- License: gpl-3.0
- Created: 2022-10-31T22:47:33.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T18:59:22.000Z (over 3 years ago)
- Last Synced: 2025-04-09T07:51:21.911Z (about 1 year ago)
- Topics: cli, diff, tool, utility
- Language: C++
- Homepage:
- Size: 56.6 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# dir-diff
dir-diff is an utility that computes the difference between two directories and
displays it in a human-friendly format.
## Building
dir-diff is a regular [Meson](https://mesonbuild.com) project, with no extra
compile-time options.
To build it, you will need:
- a C++20 compiler.
- [fmt](https://github.com/fmtlib/fmt) if your C++ standard library does not
provide `std::format`/`std::print`.
## Usage
Basic usage is as follows:
```
$ dir-diff dir1 dir2
```
The two paths should point to the directories whose contents are to be compared.
For a list of options, see `dir-diff --help`.
When a difference is detected, the program will first print a legend, and the diff
below.
## How it works
The tool starts at the root of both directories, and first builds a union of the
sets of files in both directories.
Then checks which files mismatch. The way the mismatch is detected is as follows
(the steps are ordered in a way where if a match/mismatch is detected, further checks
are skipped):
1. the existence of the file in both directories is checked (mismatch if missing in one),
2. the file type is compared (mismatch if not equal),
3. the file contents are compared, for directories this means applying the same
algorithm recursively, while for other file types:
1. the file sizes are compared (regular files only, mismatch if not equal),
2. the inode and device numbers they're on are compared (assumed same if numbers match),
3. the link targets are compared (for symlinks),
4. the file contents are compared (for regular files),
5. the target device numbers are compared (for special files).
## License
This project is licensed under the GPLv3 (or later) license.
Additionally, this project incorporates the [wildmatch](https://github.com/davvid/wildmatch)
library as a submodule, which is licensed under the BSD-3-Clause license.