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

Re: [PATCH 1/7] refs/packed: de-globalize handling of "core.packedRefsTimeout"

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 10, 2026, 05:56 UTC
Message-ID
<alCJpxAQwpTQ4g93@pks.im>
In-Reply-To
<xmqq7bn4ov1g.fsf@gitster.g>
On Thu, Jul 09, 2026 at 11:52:11AM -0700, Junio C Hamano wrote:
Show 49 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > diff --git a/refs/packed-backend.c b/refs/packed-backend.c
> > index 499cb55dfa..5c49c06493 100644
> > --- a/refs/packed-backend.c
> > +++ b/refs/packed-backend.c
> > @@ -162,6 +162,13 @@ struct packed_ref_store {
> >  	 * `packed_ref_store`) must not be freed.
> >  	 */
> >  	struct tempfile *tempfile;
> > +
> > +	/*
> > +	 * Timeout when taking the "packed-refs.lock" file. configurable via
> > +	 * "core.packedRefsTimeout".
> > +	 */
> > +	bool timeout_configured;
> > +	int timeout_value;
> >  };
> >  
> >  /*
> > @@ -1233,12 +1240,10 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)
> >  	struct packed_ref_store *refs =
> >  		packed_downcast(ref_store, REF_STORE_WRITE | REF_STORE_MAIN,
> >  				"packed_refs_lock");
> > -	static int timeout_configured = 0;
> > -	static int timeout_value = 1000;
> >  
> > -	if (!timeout_configured) {
> > -		repo_config_get_int(the_repository, "core.packedrefstimeout", &timeout_value);
> > -		timeout_configured = 1;
> 
> In the original code, when core.packedrefstimeout is not configured,
> our call to repo_config_get_int() does not touch timeout_value.  As
> a result, we get the static 1000 and flip the "configured" flag to
> prevent this _value from further getting updated.
> 
> > +	if (!refs->timeout_configured) {
> > +		repo_config_get_int(ref_store->repo, "core.packedrefstimeout", &refs->timeout_value);
> > +		refs->timeout_configured = true;
> 
> But what happens in the new code when core.packedrefstimeout is not
> configured?  It is up to whoever initialised refs->timeout_value.
> 
> If I am not mistaken, packed_ref_store_init() does xcalloc(), lets
> base_ref_store_init() initialise some members, initialises a few
> members itself (such as .store_flags and .path), and leaves other
> members, including .timeout_configured and .timeout_value,
> NUL-filled.  .timeout_configured starting as false is perfectly
> fine, but shouldn't we initialise .timeout_value to 1000 as before?

Ugh, we should. That's what happens when you tack on a last-minute patch to a series you had sitting around for weeks. Thanks for noticing!

Patrick
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 4 of 38 in “refs: remove use of `the_repository`”
  1. 0/7 refs: remove use of `the_repository`Patrick Steinhardt, Jul 9, 2026
  2. 1/7 refs/packed: de-globalize handling of "core.packedRefsTimeout"Patrick Steinhardt, Jul 9, 2026
  3. Junio C HamanoJul 9, 2026
  4. Patrick SteinhardtJul 10, 2026
  5. 2/7 refs/packed: drop `USE_THE_REPOSITORY_VARIABLE`Patrick Steinhardt, Jul 9, 2026
  6. 3/7 refs/files: drop `USE_THE_REPOSITORY_VARIABLE`Patrick Steinhardt, Jul 9, 2026
  7. 4/7 worktree: refactor code to use available repositoriesPatrick Steinhardt, Jul 9, 2026
  8. 5/7 worktree: pass repository to file-local functionsPatrick Steinhardt, Jul 9, 2026
  9. 6/7 worktree: pass repository to public functionsPatrick Steinhardt, Jul 9, 2026
  10. 7/7 refs: remove remaining uses of `the_repository`Patrick Steinhardt, Jul 9, 2026
  11. Junio C HamanoJul 9, 2026
  12. Patrick SteinhardtJul 10, 2026
  13. Patrick SteinhardtJul 10, 2026
  14. Junio C HamanoJul 10, 2026
  15. Junio C HamanoJul 10, 2026
  16. Junio C HamanoJul 10, 2026
  17. 0/7 refs: remove use of `the_repository`Patrick Steinhardt, Jul 15, 2026
  18. 1/7 refs/packed: de-globalize handling of "core.packedRefsTimeout"Patrick Steinhardt, Jul 15, 2026
  19. 2/7 refs/packed: drop `USE_THE_REPOSITORY_VARIABLE`Patrick Steinhardt, Jul 15, 2026
  20. Toon ClaesJul 15, 2026
  21. Patrick SteinhardtJul 16, 2026
  22. 3/7 refs/files: drop `USE_THE_REPOSITORY_VARIABLE`Patrick Steinhardt, Jul 15, 2026
  23. 4/7 worktree: refactor code to use available repositoriesPatrick Steinhardt, Jul 15, 2026
  24. 5/7 worktree: pass repository to file-local functionsPatrick Steinhardt, Jul 15, 2026
  25. 6/7 worktree: pass repository to public functionsPatrick Steinhardt, Jul 15, 2026
  26. 7/7 refs: remove remaining uses of `the_repository`Patrick Steinhardt, Jul 15, 2026
  27. Toon ClaesJul 15, 2026
  28. Junio C HamanoJul 15, 2026
  29. 0/6 refs: remove use of `the_repository`Patrick Steinhardt, Jul 16, 2026
  30. 1/6 refs/packed: de-globalize handling of "core.packedRefsTimeout"Patrick Steinhardt, Jul 16, 2026
  31. 2/6 refs/files: drop `USE_THE_REPOSITORY_VARIABLE`Patrick Steinhardt, Jul 16, 2026
  32. 3/6 worktree: refactor code to use available repositoriesPatrick Steinhardt, Jul 16, 2026
  33. 4/6 worktree: pass repository to file-local functionsPatrick Steinhardt, Jul 16, 2026
  34. 5/6 worktree: pass repository to public functionsPatrick Steinhardt, Jul 16, 2026
  35. 6/6 refs: remove remaining uses of `the_repository`Patrick Steinhardt, Jul 16, 2026
  36. Christian CouderJul 16, 2026
  37. Junio C HamanoJul 16, 2026
  38. Toon ClaesJul 16, 2026

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.