git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elazar Leibovich <elazar.leibovich@oracle.com>
Cc: Git mailing list <git@vger.kernel.org>,
	idan brown <idan.brown@oracle.com>,
	Liran Alon <liran.alon@oracle.com>,
	Eyal Moscovici <eyal.moscovici@oracle.com>,
	nikita.leshchenko@oracle.com
Subject: Re: Unfortunate interaction between git diff-index and fakeroot
Date: Thu, 07 Dec 2017 07:31:08 -0800	[thread overview]
Message-ID: <xmqqzi6ueern.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <0190ae30-b6c8-2a8b-b1fb-fd9d84e6dfdf@oracle.com> (Elazar Leibovich's message of "Thu, 7 Dec 2017 11:03:57 +0200")

Elazar Leibovich <elazar.leibovich@oracle.com> writes:

> We noticed some unexpected behavior of git, when running git commands under
> fakeroot, and then running another command without fakeroot.
>
> When running, e.g., git status, or git describe --dirty, git can
> update the index file.

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.

> The unexpected result is:
>
> "fakeroot git status" updates the index, and the index now says all files
> are owned by uid:0.

You should learn to expect it; that is how fakeroot works.

> "git diff-index --name-only HEAD" is used to test if the git tree is dirty
> without fakeroot, concluding all files have changed, since their owner UID
> is changed.

The lower-level plumbing diff-* commands are meant to be used by
scripts that refresh the index once upfront.

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.

  reply	other threads:[~2017-12-07 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07  9:03 Unfortunate interaction between git diff-index and fakeroot Elazar Leibovich
2017-12-07 15:31 ` Junio C Hamano [this message]
2017-12-08  9:48   ` Elazar Leibovich
2017-12-08 15:38     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzi6ueern.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=elazar.leibovich@oracle.com \
    --cc=eyal.moscovici@oracle.com \
    --cc=git@vger.kernel.org \
    --cc=idan.brown@oracle.com \
    --cc=liran.alon@oracle.com \
    --cc=nikita.leshchenko@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).