git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] sparse-checkout: respect core.ignoreCase in cone mode

From
Derrick Stolee <stolee@gmail.com>
Date
Dec 11, 2019, 19:11 UTC
Message-ID
<9dbf6d43-ac1e-4790-84e5-4829d21f5fdb@gmail.com>
In-Reply-To
<xmqqtv66og63.fsf@gitster-ct.c.googlers.com>
On 12/11/2019 1:44 PM, Junio C Hamano wrote:
Show 26 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> Another option would be to do case-insensitive checks while
>> updating the skip-worktree bits during unpack_trees(). Outside of
>> the potential performance loss on a more expensive code path, that
>> also breaks compatibility with older versions of Git as using the
>> same sparse-checkout file would change the paths that are included.
> 
> I haven't thought things through, but that sounds as if saying that
> we cannot fix old bugs.  We use the entries in the index as a hint
> for "correcting" a path to the right case on a case-insensitive
> filesystem to avoid corrupting the case in the index, which is case
> sensitive and is a way to convey the intended case (by writing them
> out to a tree object) to those who use systems that can reliably
> reproduce cases in pathnames.  But that still does not mean on a
> case-insensitive filesystem, "hello.c" in the "right" case recorded
> in the index will always be spelled like so---somebody can make
> readdir() or equivalent to yield "Hello.c" for it, and if the user
> tells us to say they want to do X (e.g. ignore, skip checkout, etc.)
> to "hello.c", we should do the same to "Hello.c" on such a system, I
> would think.
> 
> If the runtime needs to deal with the case insensitive filesystems
> anyway (and I suspect it does), there isn't much point matching and
> forcing the case to the paths in the index like this patch does, I
> think.  So...
I'm trying to find a way around these two ideas:
1. The index is case-sensitive, and the sparse-checkout patterns are
   case-sensitive.
2. If a filesystem is case-insensitive, most index-change operations
   already succeed with incorrect case, especially with core.ignoreCase
   enabled.

The approach I have is to allow a user to provide a case that does not match the index, and then we store the pattern in the sparse-checkout that matches the case in the index.

Another approach would be to make the sparse-checkout patterns be case-insensitive when core.ignoreCase is enabled. I chose against this due to the compatibility and the performance cost. We would likely pay that performance penalty even if all the patterns have the correct case. It violates the existing "contract" with the sparse-checkout file, and that is probably what you are talking about with "we cannot fix old bugs".

It sounds like you are preferring this second option, despite the performance costs. It is possible to use a case-insensitive hashing algorithm when in the cone mode, but I'm not sure about how to do a similar concept for the normal mode.

Thanks, -Stolee

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 16 in “sparse-checkout: respect core.ignoreCase in cone mode”
  1. 0/1 sparse-checkout: respect core.ignoreCase in cone modeDerrick Stolee via GitGitGadget, Dec 9, 2019
  2. 1/1 sparse-checkout: respect core.ignoreCase in cone modeDerrick Stolee via GitGitGadget, Dec 9, 2019
  3. Junio C HamanoDec 11, 2019
  4. Derrick StoleeDec 11, 2019
  5. Junio C HamanoDec 11, 2019
  6. Derrick StoleeDec 11, 2019
  7. Junio C HamanoDec 11, 2019
  8. Derrick StoleeDec 12, 2019
  9. Derrick StoleeDec 12, 2019
  10. Junio C HamanoDec 13, 2019
  11. Derrick StoleeDec 13, 2019
  12. Junio C HamanoDec 13, 2019
  13. 0/1 sparse-checkout: respect core.ignoreCase in cone modeDerrick Stolee via GitGitGadget, Dec 13, 2019
  14. 1/1 sparse-checkout: respect core.ignoreCase in cone modeDerrick Stolee via GitGitGadget, Dec 13, 2019
  15. Junio C HamanoDec 13, 2019
  16. Ed MasteDec 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.