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

Re: Git gc removes all packs

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 17, 2015, 20:37 UTC
Message-ID
<54E3A695.1050708@alum.mit.edu>
In-Reply-To
<20150217165514.GA12176@peff.net>
On 02/17/2015 05:55 PM, Jeff King wrote:
Show 28 quoted lines
> On Tue, Feb 17, 2015 at 05:39:27PM +0100, Michael Haggerty wrote:
> 
>>> You can't symlink refs like this. The loose refs in the filesystem may
>>> be migrated into the "packed-refs" file, at which point your symlink
>>> will be broken. That is a likely reason why git would not find any refs.
>>>
>>> So your setup will not ever work reliably.  But IMHO, it is a bug that
>>> git does not notice the broken symlink and abort an operation which is
>>> computing reachability in order to drop objects. As you noticed, it
>>> means a misconfiguration or filesystem error results in data loss.
>>
>> There's a bunch of code in refs.c that is there explicitly for reading
>> loose references that are symlinks. If the link contents literally start
>> with "refs/", then they are read and treated as a symbolic ref.
>> Otherwise, the symlink is just followed.
> 
> Right, but we should be able to notice that:
> 
>   1. We found a symlink.
> 
>   2. We couldn't read it its ref value (because it's a broken link).
> 
> I think we _do_ notice that at the lowest level, and set REF_ISBROKEN.
> But the problem is that the reachability code in prune and in
> pack-objects (triggered by "repack -ad") uses for_each_ref, and not
> for_each_rawref. So they ignore "broken" refs rather than complaining,
> even though failing to read a ref may mean we could drop objects which
> were only mentioned by that ref.

Yes, this makes sense too. But my point was that sticking symlinks to random files in your refs hierarchy is pretty questionable even *before* the symlink gets broken. If we would warn the user as soon as we saw such a thing, then the user's problem would never have advanced as far as it did. Do you think that emitting warnings on *intact* symlinks is too draconian?

> [...]
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
Previous: Jeff KingNext: Junio C Hamano
Message 5 of 10 in “Git gc removes all packs”
  1. Dmitry NeverovFeb 5, 2015
  2. Jeff KingFeb 5, 2015
  3. Michael HaggertyFeb 17, 2015
  4. Jeff KingFeb 17, 2015
  5. Michael HaggertyFeb 17, 2015
  6. Junio C HamanoFeb 17, 2015
  7. Michael HaggertyFeb 17, 2015
  8. Junio C HamanoFeb 18, 2015
  9. Dmitry NeverovFeb 27, 2015
  10. Jeff KingFeb 27, 2015

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.