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

Re: [PATCH] Add git-relink-script to fix up missing hardlinks

From
Junio C Hamano <junkio@cox.net>
Date
Jun 26, 2005, 19:07 UTC
Message-ID
<7v7jghq6lt.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050626181516.GC20369@mythryan2.michonline.com>

Not that I think it matters that much anymore since I am proposing removal of "delta" support and Linus seems to be inclined in the same direction, but I said "most of the time" in the earlier message on this same topic for a reason:

    Message-ID: <7vy89h36da.fsf@assigned-by-dhcp.cox.net>
    Subject: Re: RFE: git relink
    Date: Fri, 10 Jun 2005 20:44:01 -0700
    References: <42A88C07.5050907@pobox.com>
    Whoever is doing this script needs to be a bit careful.
    ...
    Ryan Anderson code will notice delta vs full object case most of
    the time because it checks and makes sure the sizes of
    corresponding files from two repositories match.  The problem
    with the code is that it dies, instead of just ignoring, when
    size differs....

Your latest version has an option not to die which is very good [*1*], but in a very narrow corner case, without comparing the file contents, I think the code would still do a wrong thing. Two trees can store the same object both in delitified form but based on different base objects, and the deltified representation still having the same length, no? And I suspect you would end up linking them together, corrupting one of the trees.

Of course, even when you do not have "delta", if an object in one tree is corrupted (but has the correct size), you would end up relinking the corrupt one into another tree, nuking a good copy, if you do not compare the file contents.

If/when/after the proposed removal of "delta" support happens, I think the correct way to do git-relink-script would be to keep most of your latest version intact, except:

 (1) make it always die when you see differences in size.
     Without "delta" in the repository, SHA1 files that
     represent the same object must have the same size.
 (2) make --safe also check on file contents.  You do not need
     the flag for the "delta" reason anymore, so I am suggesting
     reusing the flag to detect file corruption, to be extra
     safe, when the user permits you to spend cycles to be more
     careful.
[Footnote]
*1* and other parts of the script all look nicely done.
Previous: Jeff GarzikNext: Junio C Hamano
Message 3 of 6 in “Add git-relink-script to fix up missing hardlinks”
  1. Add git-relink-script to fix up missing hardlinksRyan Anderson, Jun 26, 2005
  2. Jeff GarzikJun 26, 2005
  3. Junio C HamanoJun 26, 2005
  4. Junio C HamanoJun 26, 2005
  5. Jeff GarzikJun 26, 2005
  6. Jan HarkesJun 27, 2005

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.