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

Re: [PATCH] refs: fix format migration on Cygwin

From
Jeff King <peff@peff.net>
Date
Jul 23, 2024, 20:52 UTC
Message-ID
<20240723205232.GB6779@coredump.intra.peff.net>
In-Reply-To
<d031aef5552d894784650a8c6580925e877df794.1721731179.git.ps@pks.im>
On Tue, Jul 23, 2024 at 02:31:28PM +0200, Patrick Steinhardt wrote:
Show 15 quoted lines
> @@ -2874,10 +2882,14 @@ int repo_migrate_ref_storage_format(struct repository *repo,
>  	 */
>  	initialize_repository_version(hash_algo_by_ptr(repo->hash_algo), format, 1);
>  
> -	free(new_refs->gitdir);
> -	new_refs->gitdir = xstrdup(old_refs->gitdir);
> -	repo->refs_private = new_refs;
> +	/*
> +	 * Unset the old ref store and release it. `get_main_ref_store()` will
> +	 * make sure to lazily re-initialize the repository's ref store with
> +	 * the new format.
> +	 */
>  	ref_store_release(old_refs);
> +	FREE_AND_NULL(old_refs);
> +	repo->refs_private = NULL;

I think this FREE_AND_NULL() is not technically part of the fix that the commit message describes. It is fixing an existing leak that happens when we overwrite repo->refs_private (whether with new_refs or with NULL).

That said, I don't know that it's worth going back to split it out now.

The rest of the patch looks good to me, and the commit message nicely describes the problem and solution.

-Peff
Previous: Junio C Hamano
Message 15 of 15 in “v2.46.0-rc0 test failures on cygwin”
  1. Ramsay JonesJul 16, 2024
  2. Jeff KingJul 17, 2024
  3. Junio C HamanoJul 17, 2024
  4. Ramsay JonesJul 17, 2024
  5. Ramsay JonesJul 17, 2024
  6. Jeff KingJul 18, 2024
  7. Ramsay JonesJul 18, 2024
  8. Junio C HamanoJul 18, 2024
  9. Adam DinwoodieJul 21, 2024
  10. Patrick SteinhardtJul 23, 2024
  11. Jeff KingJul 23, 2024
  12. refs: fix format migration on CygwinPatrick Steinhardt, Jul 23, 2024
  13. Ramsay JonesJul 23, 2024
  14. Junio C HamanoJul 23, 2024
  15. Jeff KingJul 23, 2024

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.