Web lists-archives.com

Re: [PATCH v3 1/1] abspath_part_inside_repo: respect core.fileMode

Junio C Hamano <gitster@xxxxxxxxx> writes:

> the resulting index entry is "blub" or "BLUB".  Shouldn't we verify
> that "git add" adds an expected path to the index, instead of
> blindly trusting that it says "Yeah, I did as I was told" with its
> exit status?  Would we be adding 'blub' as that is what we told
> 'git' to add, or would it be 'BLUB' as that is what exists on the
> filesystem that is case insensitive but case preserving?

Needless to say, the last part of the above is a mere thetorical
question, and I am not questioning the established behaviour or
suggesting to "improve" it.  On a case insensitive filesystem, we
trust what readdir() gave us (but match them with pathspec case
insensitively) for a new path that is not in the index.  When we
update the contents of a path that is already in the index, we
preserve the case in the index, even when readdir() reports the same
path in different case (iow, we trust the case in the index more
than what readdir() gives us)..

What I am wondering in the above is if we should document that in
the test, perhaps with a simple

	git ls-files blub >actual &&
	echo BLUB >expect &&
	test_cmp expect actual

or something like that.