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

Re: "git symbolic-ref" doesn't do a very good job

From
Jeff King <peff@peff.net>
Date
Aug 1, 2022, 17:43 UTC
Message-ID
<YugQqp4oN26OFOpt@coredump.intra.peff.net>
In-Reply-To
<CAHk-=wi5pfUcuaAUz=rifon9d51mshE7k6bkpMXddog0On9jow@mail.gmail.com>
On Sat, Jul 30, 2022 at 05:44:25PM -0700, Linus Torvalds wrote:
Show 7 quoted lines
> Put another way: I think my patch is likely the right thing to do (and
> I'd personally prefer the stricter check without the ALLOW_ONELEVEL
> flag), but you and Junio are right about it being a bigger change than
> I in my naivete thought it was.
> 
> So I won't really push for this, I suspect this needs very much to be
> a judgement call by you guys.
Just to lay out the options, I think we have:
  1. Do nothing. This breaks nothing. ;)
  2. Your patch, but with ALLOW_ONELEVEL. This fixes nonsense like
     "foo..bar", but doesn't break "FETCH_HEAD". Requires fixing t4202's
     ".lock" example. Replaces the HEAD starts_with("refs/") check.
  3. Your patch as-is. Same as (2), but also breaks FETCH_HEAD.
  4. Your patch, plus any extra tightening of HEAD to refs/heads/. I
     think this is probably breaking too much (I put more details
     elsewhere in the thread).

I'd be in favor of (2), which is really just catching syntactically invalid crap, and shouldn't break anyone. Technically it's possible somebody could be using a symref pointing at arbitrary data for who-knows-what reason, and extracting it with "symbolic-ref", but that is getting beyond far-fetched, I think.

I'm also tempted by (3), but we should be prepared for obscure breakage reports.

-Peff
Previous: Linus TorvaldsNext: Jeff King
Message 7 of 17 in “"git symbolic-ref" doesn't do a very good job”
  1. Linus TorvaldsJul 30, 2022
  2. Linus TorvaldsJul 30, 2022
  3. Junio C HamanoJul 30, 2022
  4. Jeff KingJul 31, 2022
  5. Jeff KingJul 31, 2022
  6. Linus TorvaldsJul 31, 2022
  7. Jeff KingAug 1, 2022
  8. Jeff KingAug 1, 2022
  9. Jeff KingAug 1, 2022
  10. Junio C HamanoAug 1, 2022
  11. Jeff KingAug 2, 2022
  12. Junio C HamanoAug 2, 2022
  13. Linus TorvaldsAug 1, 2022
  14. Junio C HamanoJul 31, 2022
  15. Jeff KingAug 1, 2022
  16. Linus TorvaldsAug 1, 2022
  17. Jeff KingAug 1, 2022

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.