Subject: Re: [PATCH v7 0/2] diff-files: integrate with sparse index

From: Junio C Hamano <[email-masked]>
Date: Thu, 23 Mar 2023 09:03:20 -0700

Shuqi Liang <[email-masked]> writes:

> When the index file is not up-to-date, git diff-files may show differences
> between the working directory and the index that are caused by file creation
> time differences, rather than actual changes to the file contents. By using git
> diff-files --stat, which ignores file creation time differences.

Use of "diff-files --stat" would mean that the contents of the blob
registered in the index will be inspected, which can be used to hide
the "stat dirty" condition.

But doesn't it cut both ways?  Starting from a clean index that has
up-to-date stat information for paths, we may want to test what
"stat dirty" changes diff-files reports when we touch paths in the
working tree, both inside and outside the spase cones.  A test with
"--stat" will not achieve that, exactly because it does not pay
attention to and hides the stat dirtiness.

On the other hand, if "update-index --refresh" is used in the test,
we may discover breakages caused by "update-index" not handling
the sparse index correctly.  It would be outside the topic of this
series, so avoiding it would be simpler, but (1) if it is not broken,
then as you said, it would be a more direct way to test diff-files,
and (2) if it is broken, it would need to be fixed anyway, before or
after this series.  So, I dunno...

Thanks.