Re: [PATCH 1/1] worktree refs: fix case sensitivity for 'head'
From: Duy Nguyen <hidden>
Date: 2018-12-14 17:47:27
On Fri, Dec 14, 2018 at 6:38 PM Duy Nguyen [off-list ref] wrote:
On Fri, Dec 14, 2018 at 6:22 PM Jacob Keller [off-list ref] wrote:quoted
On Thu, Dec 13, 2018 at 11:38 PM Duy Nguyen [off-list ref] wrote:quoted
Even with a new ref storage, I'm pretty sure pseudo refs like HEAD, FETCH_HEAD... will forever be backed by filesystem. HEAD for example is part of the repository signature and must exist as a file. We could also lookup pseudo refs with readdir() instead of lstat(). On case-preserving-and-insensitive filesystems, we can reject "head" this way. But that comes with a high cost. -- DuyOnce other refs are backed by something that doesn't depend on filesystem case sensitivity, you could enforce that we only accept call-caps HEAD as a psuedo ref, and always look up other spellings in the other refs backend, though, right?Hmm.. yes. I don't know off hand if we have any pseudo refs in lowercase. Unlikely so yes this should work.
One thing we could do _today_ without waiting for a new refs backend is, avoid looking up pseudo refs if the given ref name is not all-caps. So "head" (or hEAd) can match refs/head, refs/tags/head, refs/heads/head but never $GIT_DIR/HEAD. And yes I checked the code, pseudo refs must be all-caps. -- Duy