I recently started using Git. One of the interesting features that I discovered was the use of hashes to quickly detect changes.
On the other hand, I see that build tools (e.g. make, ant, javac, etc.) try to detect changes in the source files by checking the timestamp of the file.
Problems in this approach:
- If you are working on several machines, you must make sure that all the clocks are synchronized, otherwise the new file may not be reviewed, because other machine clocks gave it a time stamp of the past relative to the assembly machine.
- In a large project, you need to scan the timestamp of all files to detect changes.
Interestingly, someone already adopted the Git approach to solve these problems:
- Each file has a unique hash, depending on its contents, not a timestamp.
- Each directory also has its own hash, depending on the files in the directory and their hashes.
- Even a simple change inside the source tree causes the root directory to have a different hash due to the above rules.
Such a mechanism can help make the build tools much faster, since detecting a change in the source tree is a simple hash comparison operation. If the hash of the root directory of the source tree has changed, it means that the change occurred deeper in the source tree, so keep scanning the tree recursively for changes - just like Git does to detect changes.
, Git.
, - /, , . , .
Sun ZFS, , .
?
?
?