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

Re: [RFC] deprecating and eventually removing "git relink"?

From
PSPhillip Susi <psusi@cfl.rr.com>
Date
Nov 21, 2011, 22:09 UTC
Message-ID
<4ECACC13.7050507@cfl.rr.com>
In-Reply-To
<20111114103451.GA10847@sigill.intra.peff.net>
On 11/14/2011 5:34 AM, Jeff King wrote:
Show 12 quoted lines
> One issue with this scheme (or most similar schemes) is that child repos
> are uniquely identified by their directory name. In the absence of
> alternates, it's perfectly reasonable to do:
>
>    git init; hack hack hack; commit commit commit
>    cd .. ; mv project new-project-name
>
> but here it would break the shared repo's link to the child (which is
> not just inconvenient, but dangerous, as we will not respect its refs
> when pruning). Probably the "warning" above should actually error out
> and force the user to say "yes, I deleted this child" or "no, I moved it
> here".

I hacked together a setup a few weeks ago that doesn't suffer from that problem. I had two repos that had considerable shared history ( one forked from the other ), so I created a temporary repository and pointed its alternates to the other two. I then did some shell magic to generate a list of all objects shared by both repos, and sent that list to git-pack-objects. This gave me a pack file in the temp repo that contained all of the shared objects. I then made a .keep file and hard linked this pack file ( and index, and .keep file ) into both original repos, deleted the temp repo, and then repacked both original repos. This left them both with two pack files: one that is shared, and one that is all of the objects specific to that repo.

Because the shared objects are in a pack file that both repos hard link to, neither one will break if I (re)move the other. It would be nice if git relink could be enhanced to do this, then you can just periodically run relink with a list of repos and it could hard link all of the shared data into a big shared pack file, with no need to have a "master" repo that requires special handling.

Previous: Miles BaderNext: Jeff King
Message 11 of 15 in “[RFC] deprecating and eventually removing "git relink"?”
  1. Junio C HamanoNov 14, 2011
  2. Miles BaderNov 14, 2011
  3. Junio C HamanoNov 14, 2011
  4. Chris PackhamNov 14, 2011
  5. Simon BrennerNov 14, 2011
  6. Jeff KingNov 14, 2011
  7. Junio C HamanoNov 14, 2011
  8. Jeff KingNov 14, 2011
  9. Junio C HamanoNov 14, 2011
  10. Miles BaderNov 15, 2011
  11. Phillip SusiNov 21, 2011
  12. Jeff KingNov 21, 2011
  13. Phillip SusiNov 22, 2011
  14. Junio C HamanoNov 14, 2011
  15. Miles BaderNov 15, 2011

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.