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

Re: RFE: git relink

From
Junio C Hamano <junkio@cox.net>
Date
Jun 11, 2005, 03:44 UTC
Message-ID
<7vy89h36da.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<42A88C07.5050907@pobox.com>
>>>>> "JG" == Jeff Garzik <jgarzik@pobox.com> writes:

JG> It would be nice if somebody were motivated enough to create a command JG> that functions like:

JG> 	git relink repoA repoB repoC repoD... repoX
JG> which would examine

JG> repoA/.git JG> repoB/.git JG> repoC/.git JG> repoD/.git

JG> and verify (updating, if necessary) that each of the A/B/C/D repos are JG> hardlinked to repoX.

Whoever is doing this script needs to be a bit careful.

If you end up unlinking a full object and hard-linking a deltified object representation (delta) in its place, the repository can get corrupted, because it might not have the necessary base object for the delta.

There are two strategies to solve this. Either (1) the relinker refuses to replace a full object with a delta, or (2) the relinker notices a delta, and makes an additional hard link to the base object when replacing a full object with a delta (this needs to be done recursively until you hit a full base object).

(1) is simpler and cleaner, but does not get full advantage of the delta compression. (2) gives you delta compression but it will add possibly "unwanted" objects to a repository that happens to slurp in a delta (fsck would not complain, though).

My knee-jerk vote goes to (1), but in either case the relinker needs to check if it is dealing with a delta; this cannot be done with git-cat-file -t AFAIK.

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. Dying is good for ordinary case (two full object representations of the same file should not have different sizes), but it is not the right thing to do when it sees one side using the full object representation and the other side using a delta.

Previous: Ryan Anderson
Message 4 of 4 in “RFE: git relink”
  1. Jeff GarzikJun 9, 2005
  2. Ryan AndersonJun 9, 2005
  3. Ryan AndersonJun 9, 2005
  4. Junio C HamanoJun 11, 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.