Johannes Sixt <j6t@xxxxxxxx> writes: > Am 03.08.23 um 19:49 schrieb Hilco Wijbenga: >> The promise part, I was aware of. In that sense, my wording was too >> strong. It's more like "just trust me". >> >> So the "you will get what you deserve" makes sense. If the >> original/default/skeleton changes for some reason, your local changes >> will just get overwritten. Nothing surprising there. >> >> But in what scenario would Git "commit them nevertheless"? That one is >> a surprise to me and is a bit worrisome. > > I don't know. In my book it is called "undefined behavior". Anything can > happen, including things that I did not enumerate. Exactly. "Is commit affected?" and "Can we guarantee that operation X is not affected?" are meaningless questions, as our implementation is not frozen and we reserve the right to take any valid optimization oppoertunities as long as correctness is not violated. The assume unchanged bit allows Git to take advantage of the promise the user has made and choose whichever is more efficient and/or convenient to use between the file in the working tree and the blob object for a given path when that bit is set. When you expect an existing blob object to be used (e.g. the one registered in the index), in _any_ operation (which is defined now or will be invented in the future), Git is allowed to instead use the contents of the corresponding working tree file. Or vice versa. Perhaps you may be creating an archive of some format out of the tree of HEAD, and may expect that local changes in the working tree would not have any effect in the result. But instead of having to reconstruct the contents of a blob object known to be at path "README" in the tree by uncompressing the base object and then repeatedly applying delta data read from different parts of a packfile, it may be easier/faster to open/read the file in the working tree. And if there is such a promise from the user that the contents of the file will be kept the same as what was in the index and the HEAD, Git is allowed to do so. If the contents of the file was different from the blob, the resulting archive will not be an archive of the tree of HEAD, but that is "what you deserve".