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

Re: Missing Refs after Garbage Collection

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Dec 22, 2012, 22:26 UTC
Message-ID
<CAHkcotjJ8nyPVEbDFcGVYqirY4HBNBPN-PNCMriLyeU8iBEKXg@mail.gmail.com>
In-Reply-To
<C0A16EC8-D05A-41D0-BF2A-34BF3B1B839E@codeaurora.org>
Hi,
On Sat, Dec 22, 2012 at 5:41 AM, Earl Gresh <egresh@codeaurora.org> wrote:
>
> Is anyone familiar with git gc deleting valid references? I'm running
> git version 1.7.8. Have there been any patches in later git releases
> that might address this issue ( if it is a git problem )?

I have not seen any relevant changes in git. I have looked at the code, and what git-gc is running "git pack-refs --all --prune", which is very careful in packing and fsyncing the new file with all packed references before deleting anything. Only those references that were packed can be deleted. Also, it does not matter whether a reference is valid or not, or whether it is stored in refs/changes or in some other place, like refs/heads. So if references were really lost as you described, I think other people would notice that by now.

The only plausible explanation that comes to my mind now is that file creation using O_EXCL is not atomic on your system, then the lock did not work and one process could overwrite packed references created by another.

Dmitry
Previous: Earl GreshNext: Jeff King
Message 2 of 4 in “Missing Refs after Garbage Collection”
  1. Earl GreshDec 22, 2012
  2. Dmitry PotapovDec 22, 2012
  3. Jeff KingDec 23, 2012
  4. Martin FickJan 2, 2013

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.