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

Re: [PATCH v4 0/1] receive-pack: optionally deny case clone refs

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 18, 2014, 11:33 UTC
Message-ID
<53A1791B.5010301@alum.mit.edu>
In-Reply-To
<xmqqfvj81oym.fsf@gitster.dls.corp.google.com>
On 06/13/2014 11:25 PM, Junio C Hamano wrote:
Show 41 quoted lines
> Ronnie Sahlberg <sahlberg@google.com> writes:
> 
>> It gets even more hairy :
>> If the server has A/a and a/b and you clone it it becomes A/a and A/b
>> locally. Then you push back to the server and you end up with three
>> refs on the server:  A/a A/b and a/b.
> 
> That is part of the transition in deployment.  David who wants to
> forbid A/a and a/b mixed in his project will surely correct the
> situation at the server end so "somebody fetches A/a and a/b and
> ends up with A/a and A/b" will not happen.  They will fetch A/a and
> A/b.
> 
> If a user is with an older Git and he has his own a/c, fetching A/a
> and A/b from a corrected central repository will still give the user
> a/a and a/b, but then pushing it back will be forbidden.  The user's
> repository needs to be fixed and installation of Git needs to be
> updated to the version with an equivalent of David's "optionally
> deny" feature implemented for the fetching side, so that the user
> notices the local a/c is bad and not allowed within the context of
> his project, deletes it and recreates it as A/c before he can fetch
> A/a and A/b from the central repository.
> 
> I agree that the transition may be painful, but as long as the
> desired semantics is "If you have A/a, you are not allowed to have
> a/a or a/b", it cannot be avoided---in that sense, I view it as a
> lower priority issue.
> 
> Having said that, it may indicate that the desired semantics above
> may not be the optimal one.  Perhaps the flag might want to be "on
> this platform, we cannot do case sensitive refs, so pretend as if
> all refs are lowercase" instead.  I suspect that such a flag may
> allow smoother transition than what has been proposed.
> 
> Underlying refs "A/a" and "a/b" can stay as they are in David's
> central repository, but ref enumeration with the flag enabled will
> return a/a and a/b, and these are the names that will be fetched by
> the users.  If the user had an existing A/c, then fetching these
> will still create A/a and A/b locally, but pushing them back will,
> under that flag enabled, be turned into updates to a/a, a/b, and a/c
> on the central server side with updated Git.
The discussion here has made it pretty clear that, given our current
loose reference and reflog storage schemes, it is not possible to
implement case-sensitive references or even case-insensitive but
case-preserving references correctly on a non-case-sensitive filesystem.
 We would always have spooky non-local conflicts like A/a vs. a/b.
I think we *could* correctly implement
* case-folded reference names (e.g., all lower-case; I wonder if
  that would also apply to HEAD etc.?)
* case-folded reference names except for the last component, which
  could be case-insensitive but case-preserving:
  refs/heads/MyCrazyBranch.  I suppose that many mixed-OS projects
  effectively use this policy nowadays and that is why we don't hear
  more complaints about this Git deficiency.

If we had an option to use only packed references in a repository, I think we could also implement case-insensitive but case-preserving references on a non-case-preserving filesystem. The packed-refs file would be authoritative WRT case, and the case of the reflog directories and files would be ignored. But I would be nervous about promoting this style, because it will likely cause performance problems for repos that have a lot of refs.

To support arbitrary refname policies on arbitrary filesystems, we of course need a different way of storing references and reflogs.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Junio C HamanoNext: Ronnie Sahlberg
Message 15 of 18 in “receive-pack: optionally deny case clone refs”
  1. 0/1 receive-pack: optionally deny case clone refsDavid Turner, Jun 11, 2014
  2. 1/1 receive-pack: optionally deny case clone refsDavid Turner, Jun 11, 2014
  3. Torsten BögershausenJun 13, 2014
  4. Junio C HamanoJun 12, 2014
  5. David TurnerJun 12, 2014
  6. Torsten BögershausenJun 13, 2014
  7. Junio C HamanoJun 13, 2014
  8. Junio C HamanoJun 13, 2014
  9. Ronnie SahlbergJun 13, 2014
  10. Ronnie SahlbergJun 13, 2014
  11. Junio C HamanoJun 13, 2014
  12. Ronnie SahlbergJun 13, 2014
  13. David TurnerJun 15, 2014
  14. Junio C HamanoJun 13, 2014
  15. Michael HaggertyJun 18, 2014
  16. Ronnie SahlbergJun 18, 2014
  17. Ronnie SahlbergAug 13, 2014
  18. David TurnerAug 13, 2014

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.