Git fork

Merge branch 'dg/user-manual-hash-example'

User manual (the original one) update.

* dg/user-manual-hash-example:
Documentation/user-manual.txt: example for generating object hashes

+34 -2
+34 -2
Documentation/user-manual.txt
··· 4093 4093 about the data in the object. It's worth noting that the SHA-1 hash 4094 4094 that is used to name the object is the hash of the original data 4095 4095 plus this header, so `sha1sum` 'file' does not match the object name 4096 - for 'file'. 4096 + for 'file' (the earliest versions of Git hashed slightly differently 4097 + but the conclusion is still the same). 4098 + 4099 + The following is a short example that demonstrates how these hashes 4100 + can be generated manually: 4101 + 4102 + Let's assume a small text file with some simple content: 4103 + 4104 + ------------------------------------------------- 4105 + $ echo "Hello world" >hello.txt 4106 + ------------------------------------------------- 4107 + 4108 + We can now manually generate the hash Git would use for this file: 4109 + 4110 + - The object we want the hash for is of type "blob" and its size is 4111 + 12 bytes. 4112 + 4113 + - Prepend the object header to the file content and feed this to 4114 + `sha1sum`: 4115 + 4116 + ------------------------------------------------- 4117 + $ { printf "blob 12\0"; cat hello.txt; } | sha1sum 4118 + 802992c4220de19a90767f3000a79a31b98d0df7 - 4119 + ------------------------------------------------- 4120 + 4121 + This manually constructed hash can be verified using `git hash-object` 4122 + which of course hides the addition of the header: 4123 + 4124 + ------------------------------------------------- 4125 + $ git hash-object hello.txt 4126 + 802992c4220de19a90767f3000a79a31b98d0df7 4127 + ------------------------------------------------- 4097 4128 4098 4129 As a result, the general consistency of an object can always be tested 4099 4130 independently of the contents or the type of the object: all objects can ··· 4123 4154 ---------------------------------------------------- 4124 4155 4125 4156 The initial revision lays the foundation for almost everything Git has 4126 - today, but is small enough to read in one sitting. 4157 + today (even though details may differ in a few places), but is small 4158 + enough to read in one sitting. 4127 4159 4128 4160 Note that terminology has changed since that revision. For example, the 4129 4161 README in that revision uses the word "changeset" to describe what we