git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unfortunate interaction between git diff-index and fakeroot

From
ELElazar 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?
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “Unfortunate interaction between git diff-index and fakeroot”
  1. Elazar LeibovichDec 7, 2017
  2. Junio C HamanoDec 7, 2017
  3. Elazar LeibovichDec 8, 2017
  4. Junio C HamanoDec 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.