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

Re: [PATCH] check_refname_component: Optimize

From
Duy Nguyen <pclouds@gmail.com>
Date
May 31, 2014, 11:21 UTC
Message-ID
<CACsJy8BcmT1AKe=EYrYUs9Xyu9YUNbA3YUDafg2rZ9fabVgEiQ@mail.gmail.com>
In-Reply-To
<20140530000728.GC28683@sigill.intra.peff.net>
On Fri, May 30, 2014 at 7:07 AM, Jeff King <peff@peff.net> wrote:
> But then we're just trusting that the "trust me" flag on disk is
> correct. Why not just trust that packed-refs is correct in the first
> place?

I missed one thing in the first reply: because packed-refs is a plain text file, the user could be tempted to edit it manually (I know I did a few times for fast rename) and so it could not be trusted. If we ignore this (and I think we can, it's not like we encourage people to edit files in $GIT_DIR), then #3 and #4 are as good as #2.

Show 19 quoted lines
>
> IOW, consider this progression of changes:
>
>   1. Check refname format when we read packed-refs (the current
>      behavior).
>
>   2. Keep a separate file "packed-refs.stat" with stat information. If
>      the packed-refs file matches that stat information, do not bother
>      checking refname formats.
>
>   3. Put a flag in "packed-refs" that says "trust me, I'm valid". Check
>      the refnames when it is generated.
>
>   4. Realize that we already check the refnames when we write it out.
>      Don't bother writing "trust me, I'm valid"; readers can assume that
>      it is.
>
> What is the scenario that option (2) protects against that options (3)
> and (4) do not?
-- 
Duy
Previous: Michael Haggerty
Message 15 of 15 in “check_refname_component: Optimize”
  1. 0/1 check_refname_component: OptimizeDavid Turner, May 28, 2014
  2. check_refname_component: OptimizeDavid Turner, May 28, 2014
  3. Michael HaggertyMay 28, 2014
  4. David TurnerMay 28, 2014
  5. Duy NguyenMay 29, 2014
  6. Junio C HamanoMay 29, 2014
  7. Duy NguyenMay 29, 2014
  8. Jeff KingMay 29, 2014
  9. Duy NguyenMay 29, 2014
  10. Jeff KingMay 30, 2014
  11. Duy NguyenMay 30, 2014
  12. Michael HaggertyMay 30, 2014
  13. Jeff KingMay 30, 2014
  14. Michael HaggertyMay 31, 2014
  15. Duy NguyenMay 31, 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.