Elazar Leibovich <elazar.leibov...@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 via email to