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

Re: Possible bug with branch names and case sensitivity

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Nov 22, 2011, 05:21 UTC
Message-ID
<4ECB315F.4080701@alum.mit.edu>
In-Reply-To
<CAG+J_Dz6nK5fPhBRmoojmgYSv5OviN7pfgNKnRy9_9WmDS1_2w@mail.gmail.com>
On 11/21/2011 08:18 PM, Jay Soffian wrote:
Show 10 quoted lines
> On Sat, Nov 19, 2011 at 3:08 PM, Gerd Knops <gerti@bitart.com>
> wrote:
>> On Mac OS X with a case-insensitive file system (not sure if that
>> matters) git get's confused with branch names that differ only in
>> case.
> 
> This is true. The branch code assumes a case-sensitive filesystem. I 
> started working on a fix, but it was more involved than I first 
> thought it would be. See my local WIP commit below, apologies if
> gmail lines wraps it.

Is it obvious how references *should* be handled on case-insensitive filesystems? It's certainly not obvious to me (has it been discussed elsewhere?) I don't think it is a good idea to "fix" this one problem without defining an overall policy.

Currently git handles references names case-sensitively and allows multiple reference names that differ only in case. If this behavior is to be preserved on case-insensitive filesystems, then either loose references must be stored differently (e.g., multiple references in the same file) or ambiguous references need always to be packed. Moreover, given a refname, we would need to be careful not to just try to open a file with that name and assume that it is the correct reference; rather, we would have to ask the filesystem for the name of the file in its original case and make sure that it agrees with the case of the refname that we seek.

By the way, this could have ramifications for the recently-added test that top-level refnames should be in ALL_CAPS.

If we want to consider bending git's behavior, there are a number of ways we could go:

1. Remain case-sensitive but prohibit refnames that differ only in case.
2. Remain case-sensitive but prohibit refnames that differ only in case
*when running on a case-insensitive filesystem*.
3. Change the handling of refnames to be case-insensitive but
case-preserving.

The above all assumes a case-insensitive filesystem that is *case-preserving*. If we want to support filesystems that do not preserve case, things get even more complicated.

And if we want to pretend to support non-ASCII refnames, then the issue of encodings is another nasty can of worms...

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Jay SoffianNext: Jay Soffian
Message 3 of 11 in “Possible bug with branch names and case sensitivity”
  1. Gerd KnopsNov 19, 2011
  2. Jay SoffianNov 21, 2011
  3. Michael HaggertyNov 22, 2011
  4. Jay SoffianNov 22, 2011
  5. Michael HaggertyNov 23, 2011
  6. Ævar Arnfjörð BjarmasonNov 23, 2011
  7. Joshua JensenNov 23, 2011
  8. Junio C HamanoNov 22, 2011
  9. Michael HaggertyNov 23, 2011
  10. Junio C HamanoNov 23, 2011
  11. Junio C HamanoNov 22, 2011

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.