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

unlink errors under windows in git pack-refs

From
CRChristian Reich <zottelbart@t-online.de>
Date
Jan 22, 2025, 19:01 UTC
Message-ID
<d7fd0b1c-98fe-4cc3-b657-c2c3d0bc5c47@t-online.de>
What did you do before the bug happened? (Steps to reproduce your issue)
I have a git repository cloned which uses reftables.
git clone --ref-format=reftable https://github.com/eclipse-jgit/jgit.git

A jgit-program (java) is running and sleeping for 100seconds to demonstrate the problem.

         Git git = Git.init().setDirectory(new 
File("c:\\temp\\jgit")).call();
         FileRepository repo = (FileRepository) git.getRepository();
         try {
             Thread.sleep(100000);
         } catch (InterruptedException e) {
         }
         git.close();

While the jgit-program is sleeping in git-bash update a ref und pack the reftablefiles:

git update-ref refs/tags/test 939d321faccd12bff4cb13ce6358820297fbc78e
git pack-refs
What did you expect to happen? (Expected behavior)
git pack-refs should work without messages.
What happened instead? (Actual behavior)

git tries to unlink the reftable-files, but jgit hold windows-system lock, so the file can't be unlinked. An answers 'n' for retry causes more asks. After the third try git give up.

Unlink of file 'C:/temp/jgittest/jgit/.git/reftable/0x000000000002-0x000000000004-50486d0e.ref' failed. Should I try again? (y/n) n Unlink of file 'C:/temp/jgittest/jgit/.git/reftable/0x000000000002-0x000000000004-50486d0e.ref' failed. Should I try again? (y/n) n Unlink of file 'C:/temp/jgittest/jgit/.git/reftable/0x000000000002-0x000000000004-50486d0e.ref' failed. Should I try again? (y/n) n

What's different between what you expected and what actually happened?

I would expect, that git tries to unlink the files. But if this fails git should ignore this and try to delete the files next time on pack-files. Its documented in https://git-scm.com/docs/reftable

Anything else you want to add:

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.48.0.rc2.windows.1
cpu: x86_64
built from commit: 049f0cf1a5d000f1e24f0e80b79b0d043a8b83b2
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.11.1
OpenSSL: OpenSSL 3.2.3 3 Sep 2024
zlib: 1.3.1
uname: Windows 10.0 22631
compiler info: gnuc: 14.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe

[Enabled Hooks] commit-msg

Next: Patrick Steinhardt
Message 1 of 2 in “unlink errors under windows in git pack-refs”
  1. Christian ReichJan 22, 2025
  2. Patrick SteinhardtJan 24, 2025

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.