Thread (17 messages) 17 messages, 7 authors, 2018-12-14

Re: [PATCH 1/1] worktree refs: fix case sensitivity for 'head'

flat view

From: Jacob Keller <hidden>
Date: 2018-12-14 18:48:55

On Fri, Dec 14, 2018 at 9:47 AM Duy Nguyen [off-list ref] wrote:
On Fri, Dec 14, 2018 at 6:38 PM Duy Nguyen [off-list ref] wrote:
quoted
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.
--
Duy
Once 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
Right, I think that's a good start, at least for these pseudo refs. It
doesn't solve the more general case of refs mismatching, but it
prevents the obvious one where case actually matters, by preventing
head from looking up as HEAD.

Thanks,
Jake
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help