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

Re: Local clones aka forks disk size optimization

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Nov 16, 2012, 11:25 UTC
Message-ID
<50A622A9.4040709@drmicha.warpmail.net>
In-Reply-To
<CAMK1S_ioQQWXaOO8Na=7M4QhaaUNQ8ySVM-E_2bk6m4TyvRpeA@mail.gmail.com>
Sitaram Chamarty venit, vidit, dixit 15.11.2012 04:44:
Show 47 quoted lines
> On Thu, Nov 15, 2012 at 7:04 AM, Andrew Ardill <andrew.ardill@gmail.com> wrote:
>> On 15 November 2012 12:15, Javier Domingo <javierdo1@gmail.com> wrote:
>>> Hi Andrew,
>>>
>>> Doing this would require I got tracked which one comes from which. So
>>> it would imply some logic (and db) over it. With the hardlinking way,
>>> it wouldn't require anything. The idea is that you don't have to do
>>> anything else in the server.
>>>
>>> I understand that it would be imposible to do it for windows users
>>> (but using cygwin), but for *nix ones yes...
>>> Javier Domingo
>>
>> Paraphrasing from git-clone(1):
>>
>> When cloning a repository, if the source repository is specified with
>> /path/to/repo syntax, the default is to clone the repository by making
>> a copy of HEAD and everything under objects and refs directories. The
>> files under .git/objects/ directory are hardlinked to save space when
>> possible. To force copying instead of hardlinking (which may be
>> desirable if you are trying to make a back-up of your repository)
>> --no-hardlinks can be used.
>>
>> So hardlinks should be used where possible, and if they are not try
>> upgrading Git.
>>
>> I think that covers all the use cases you have?
> 
> I am not sure it does.  My understanding is this:
> 
> 'git clone -l' saves space on the initial clone, but subsequent pushes
> end up with the same objects duplicated across all the "forks"
> (assuming most of the forks keep up with some canonical repo).
> 
> The alternates mechanism can give you ongoing savings (as long as you
> push to the "main" repo first), but it is dangerous, in the words of
> the git-clone manpage.  You have to be confident no one will delete a
> ref from the "main" repo and then do a gc or let it auto-gc.
> 
> He's looking for something that addresses both these issues.
> 
> As an additional idea, I suspect this is what the namespaces feature
> was created for, but I am not sure, and have never played with it till
> now.
> 
> Maybe someone who knows namespaces very well will chip in...
> 
I dunno about namespaces, but a safe route with alternates seems to be:

Provide one "main" clone which is bare, pulls automatically, and is there to stay (no pruning), so that all others can use that as a reliable alternates source.

Michael
Previous: Sitaram ChamartyNext: Enrico Weigelt
Message 8 of 13 in “Fwd: Local clones aka forks disk size optimization”
  1. Javier DomingoNov 14, 2012
  2. Andrew ArdillNov 15, 2012
  3. Javier DomingoNov 15, 2012
  4. Andrew ArdillNov 15, 2012
  5. Javier DomingoNov 15, 2012
  6. Andrew ArdillNov 15, 2012
  7. Sitaram ChamartyNov 15, 2012
  8. Michael J GruberNov 16, 2012
  9. Enrico WeigeltNov 16, 2012
  10. Sitaram ChamartyNov 18, 2012
  11. Enrico WeigeltNov 18, 2012
  12. Pyeron, Jason J CTR (US)Nov 16, 2012
  13. Jörg RosenkranzNov 18, 2012

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.