All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Folly <steve@spfweb.co.uk>
To: git@vger.kernel.org
Subject: Re: Retrospectively add alternates to a repository?
Date: Sat, 27 Feb 2010 11:43:55 +0000 (UTC)	[thread overview]
Message-ID: <loom.20100227T123539-643@post.gmane.org> (raw)
In-Reply-To: 20100227083418.GC27191@coredump.intra.peff.net

Jeff King <peff <at> peff.net> writes:

> 
> On Sat, Feb 27, 2010 at 10:37:25AM +0800, Tay Ray Chuan wrote:
> 
> > yes, just make sure the objects/info/alternates file points to the
> > location of that cloned repo's object directory; for example:
> > 
> >   $ echo /path/to/cloned/repo/.git/objects > .git/objects/info/alternates
> 
> You will probably want to then get rid of anything in the child that is
> now available in the alternates repository.
> 
> I would have thought "git repack -adl" works, but I think there is
> something a little funny in the logic. It reports "nothing new to pack",
> but does not delete the loose objects. But packing first then worked:
> 
>   $ git clone large-parent child
>   $ echo $PWD/large-parent/.git/objects >child/.git/objects/info/alternates
>   $ cd child
> 
>   $ du -sh .git/objects
>   51M     .git/objects
> 
>   $ git repack -adl && du -sh .git/objects
>   Nothing new to pack.
>   51M     .git/objects
> 
>   $ git repack -ad && du -sh .git/objects
>   Counting objects: 3, done.
>   Delta compression using up to 2 threads.
>   Compressing objects: 100% (2/2), done.
>   Writing objects: 100% (3/3), done.
>   Total 3 (delta 0), reused 0 (delta 0)
>   51M     .git/objects
> 
>   $ git repack -adl && du -sh .git/objects
>   Nothing new to pack.
>   20K     .git/objects
> 
> -Peff
> 

Excellent, this is exactly what I need. Thanks very much Tay
 and Jeff.

I now have a plan to write a script to attach and
detach repositories to and from local mirrors on demand:

attach = 
    echo "/path/to/mirror" > .git/objects/info/alternates && 
    git repack -adl && 
    git repack -ad && 
    git repack -adl

detach = 
    git repack -a && 
    rm .git/objects/info/alternates


Cheers,
Steve

  reply	other threads:[~2010-02-27 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-26 23:54 Retrospectively add alternates to a repository? Steve Folly
2010-02-27  2:37 ` Tay Ray Chuan
2010-02-27  8:34   ` Jeff King
2010-02-27 11:43     ` Steve Folly [this message]
2010-02-27 12:30       ` Jeff King
2010-05-16 13:55         ` Felipe Contreras
2010-05-22  5:38           ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20100227T123539-643@post.gmane.org \
    --to=steve@spfweb.co.uk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.