Junio C Hamano wrote: > Victoria Dye <vdye@xxxxxxxxxx> writes: > >> The strange thing is, once I fixed the 'mkdir' issue in my local copy of >> these patches, these 'test_all_match diff-files' calls succeeded. It turns >> out that 'git diff-files' in the 'full-checkout', like in 'sparse-checkout', >> reports a difference in 'folder1/a' that doesn't actually exist. So the bug >> isn't in sparse-checkout as I initially assumed [1], but rather in >> diff-files itself. > > Is that a bug, or just a common "ah, you forgot to refresh the index"? Ah, you're right - I completely forgot about 'diff-files' not refreshing the index (since 'diff', by default, does). The ctime is (often, but not always) different on the copied file than what's in the index, so 'diff-files' shows the file as "modified" if the index isn't refreshed. Going back to these tests, the goal is to make sure that 'diff-files' finds the correct index entry (possibly in a sparse directory) and compares that correctly to what's on disk. But since we want to ignore ctime differences, we could use '--stat' (or '-p', or '--num-stat': run_on_all mkdir -p folder1 && run_on_all cp a folder1/a && # file present on-disk without modifications # use `--stat` to ignore file creation time differences in # unrefreshed index test_all_match git diff-files --stat && test_all_match git diff-files --stat folder1/a && I don't think that makes the test any less comprehensive (especially since later on in the same test, we modify the contents of 'folder1/a' and get the expected "modified" status in 'git diff-files' without '--stat'), but it avoids potential breakages related to inconsistency in file creation time.