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

Re: [PATCH v2 0/2] Avoid rewriting "packed-refs" unnecessarily

From
Jeff King <peff@peff.net>
Date
Nov 1, 2017, 07:34 UTC
Message-ID
<20171101073414.rwi426whpinv226l@sigill.intra.peff.net>
In-Reply-To
<cover.1509181545.git.mhagger@alum.mit.edu>
On Sat, Oct 28, 2017 at 11:16:00AM +0200, Michael Haggerty wrote:
Show 18 quoted lines
> This reroll make some logically small changes to v1 [1] that are
> textually very big:
> 
> * Invert the sense of `is_packed_transaction_noop()` and rename it to
>   `is_packed_transaction_needed()`. This makes the logic easier to
>   follow and document.
> 
> * Add a big comment to that function, describing the cases when it
>   returns false positives and explaining why that isn't a problem.
> 
> * In the commit message for patch 02, gives a lot more information
>   about the regression that it is fixing. Thanks to Eric for the
>   suggestion.
> 
> These patches are also available as branch
> `avoid-rewriting-packed-refs` on my GitHub fork [2]. They now use
> `mh/packed-ref-transactions` as the base, since that is where Junio
> chose to apply v1.

This all makes sense to me. I agree that the "is_needed" logic-flip in v2 makes it a little easier to think about.

Like Junio, I was thrown off at first by the HAVE_OLD check. Especially since we would not ever set that flag for the transaction we care about here. But I think the crux of it is that the packed_ref store code could in theory operate independently of the loose ref code, where we feed it more exotic inputs. And what you've written here is future-proofing against the more general case, even though it would not be strictly necessary.

-Peff
Previous: Junio C Hamano
Message 5 of 5 in “Avoid rewriting "packed-refs" unnecessarily”
  1. 0/2 Avoid rewriting "packed-refs" unnecessarilyMichael Haggerty, Oct 28, 2017
  2. 1/2 t1409: check that `packed-refs` is not rewritten unnecessarilyMichael Haggerty, Oct 28, 2017
  3. 2/2 files-backend: don't rewrite the `packed-refs` file unnecessarilyMichael Haggerty, Oct 28, 2017
  4. Junio C HamanoOct 30, 2017
  5. Jeff KingNov 1, 2017

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.