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

[PATCH v2 0/2] maintenance(geometric): avoid deadlocks on Windows 10

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
May 7, 2026, 12:51 UTC
Message-ID
<pull.2103.v2.git.1778158273.gitgitgadget@gmail.com>
In-Reply-To
<pull.2103.git.1777380768.gitgitgadget@gmail.com>

On Windows, maintenance_task_geometric_repack() opens pack index files via pack_geometry_init() (which mmap()s the .idx files), then spawns git repack as a child process without setting child.odb_to_close. The parent's mmap()s prevent the child from deleting old .idx files.

On Windows 10 builds before the POSIX delete semantics change (between Build 17134.1304 and 18363.657, see https://stackoverflow.com/a/60512798), this results in Unlink of file '.git/objects/pack/pack-<hash>.idx' failed. Should I try again? during fetch-triggered auto-maintenance with the geometric strategy.

The fix adds the missing child.odb_to_close = the_repository->objects line, matching all other maintenance tasks.

The first commit introduces a GIT_TEST_LEGACY_DELETE environment variable to simulate legacy (pre-POSIX) delete semantics on modern Windows, so the regression test can verify the fix even on Windows 11.

This fixes https://github.com/git-for-windows/git/issues/6210.
Changes since v1:
 * The code now uses git_env_bool() as appropriate (thanks Patrick!)
Johannes Schindelin (2):
  mingw: optionally use legacy (non-POSIX) delete semantics
  maintenance(geometric): do release the `.idx` files before repacking
 builtin/gc.c           |  1 +
 compat/mingw.c         | 47 ++++++++++++++++++++++++++++++++++++++++--
 t/t7900-maintenance.sh | 22 +++++++++++++++++++-
 3 files changed, 67 insertions(+), 3 deletions(-)
base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2103%2Fdscho%2Favoid-deadlocks-in-geometric-repacking-on-windows-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2103/dscho/avoid-deadlocks-in-geometric-repacking-on-windows-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2103
Range-diff vs v1:
 1:  97508e91b6 ! 1:  8ee749dd2f mingw: optionally use legacy (non-POSIX) delete semantics
     @@ compat/mingw.c: static wchar_t *normalize_ntpath(wchar_t *wbuf)
       
      -	if (DeleteFileW(wpathname))
      +	if (use_legacy_delete < 0)
     -+		use_legacy_delete = !!getenv("GIT_TEST_LEGACY_DELETE");
     ++		use_legacy_delete = git_env_bool("GIT_TEST_LEGACY_DELETE", 0);
      +
      +	if (try_delete_file(wpathname, use_legacy_delete))
       		return 0;
 2:  12ebd5c56f = 2:  66219b79fa maintenance(geometric): do release the `.idx` files before repacking
-- 
gitgitgadget
Previous: Patrick SteinhardtNext: Johannes Schindelin via GitGitGadget
Message 8 of 11 in “maintenance(geometric): avoid deadlocks on Windows 10”
  1. 0/2 maintenance(geometric): avoid deadlocks on Windows 10Johannes Schindelin via GitGitGadget, Apr 28, 2026
  2. 1/2 mingw: optionally use legacy (non-POSIX) delete semanticsJohannes Schindelin via GitGitGadget, Apr 28, 2026
  3. Patrick SteinhardtMay 4, 2026
  4. Johannes SchindelinMay 7, 2026
  5. 2/2 maintenance(geometric): do release the `.idx` files before repackingJohannes Schindelin via GitGitGadget, Apr 28, 2026
  6. Derrick StoleeApr 28, 2026
  7. Patrick SteinhardtMay 4, 2026
  8. 0/2 maintenance(geometric): avoid deadlocks on Windows 10Johannes Schindelin via GitGitGadget, May 7, 2026
  9. 1/2 mingw: optionally use legacy (non-POSIX) delete semanticsJohannes Schindelin via GitGitGadget, May 7, 2026
  10. 2/2 maintenance(geometric): do release the `.idx` files before repackingJohannes Schindelin via GitGitGadget, May 7, 2026
  11. Patrick SteinhardtMay 8, 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.