On Wed, Jan 03, 2024 at 09:21:13AM -0800, Junio C Hamano wrote: > Patrick Steinhardt <ps@xxxxxx> writes: > > > ... But the problem is that tools like git-update-ref(1) don't > > enforce this, so something like `git update-ref foo/bar HEAD` happily > > creates "$GIT_DIR/foo/bar". And I bet there are other ways to write refs > > at arbitrary paths. > > I think we should tighten things up over time. First by teaching > the ref backend that anything that is not a pseudoref, HEAD or a > proper ref (one item of whose definition is "lives under refs/ > hierarchy) should not resolve_ref() successfully. That should > correctly fail things like > > $ git rev-parse worktrees/$name/bisect/bad > $ git update-ref foo/bar HEAD > > I'd hope. > > Thanks. Yeah, agreed, that's something we should do. I do wonder whether this will break existing usecases, but in any case I'd rather consider it an accident that it is possible to write (and read) such refs in the first place. Patrick
Attachment:
signature.asc
Description: PGP signature