Re: Unfortunate interaction between git diff-index and fakeroot
- From
- Elazar Leibovich <elazar.leibovich@oracle.com>
- Date
- Dec 8, 2017, 09:48 UTC
- Message-ID
- <a770d158-c472-206f-dcdc-55cea0cf308f@oracle.com>
- In-Reply-To
- <xmqqzi6ueern.fsf@gitster.mtv.corp.google.com>
On 12/07/2017 05:31 PM, Junio C Hamano wrote:
Show 5 quoted lines
> Correct. fakeroot would report that the files that are actually > owned by the user who is running fakeroot are owned by root; the > cached stat information in the index would be "corrected" to say > that they are owned by root. So once the index is refreshed like > so, things will become consistent.
I still fail to understand, what's the benefit of storing the owner ID in the index, where no one seems to use this information. I mean, one could store many other meta information in the index, such as ACL lists, number of blocks allocated, etc, but the code seems to ignore unused information, such as commit 2cb45e95438c113871fbbea5b4f629f9463034e7 which ignores st_dev, because it doesn't actually matter, or commit e44794706eeb57f2ee38ed1604821aa38b8ad9d2 which ignores mode changes not relevant to the owner.
In which situation does anyone care about the owner UID? What's the difference between that, and, e.g., st_dev?
> If you are using "diff-index" for the "is the tree dirty?" check > without running "update-index --refresh", then you are not using > the command correctly.
Just want to clarify. It seems like the linux kernel is using diff-index to do just that, in scripts/setlocalversion
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/setlocalversion#n77
Do I understand correctly that linux should update the index first, or better, use porcelain "git diff --name-only" instead?
It seems to be the case previously, but in commit cdf2bc632ebc9ef512345fe8e6015edfd367e256 git update-index was removed, to prevent error messages on read-only linux tree.
Do I understand correctly that the more correct solution for modern git, is to use git diff --name-only instead? It should work on read-only as well as on read-write trees, and would not break if anyone uses git under fakeroot.
Did I understand you correctly?