All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: James Cloos <cloos@jhcloos.com>
Cc: git@vger.kernel.org
Subject: Re: efficient cloning
Date: Sun, 19 Mar 2006 17:31:12 -0500	[thread overview]
Message-ID: <20060319223111.GA20464@spearce.org> (raw)
In-Reply-To: <m3r74ykue7.fsf@lugabout.cloos.reno.nv.us>

James Cloos <cloos@jhcloos.com> wrote:
> Is there a way to accomplish the effect of this script w/o having to
> download any unnecessary objects?
> 
> ==================================================
> #!/bin/bash
> 
> lt="/gits/linux-2.6/.git"
> 
> if [ $# -ne 2 ]; then
>     echo >&2 "Usage: $0 <repo> <target-dir>"
>     exit 1
> fi
> 
> git-clone $1 $2
> mkdir -p $2/objects/info
> {
>  test -f "$lt/objects/info/alternates" &&
>  cat "$lt/objects/info/alternates";
>  echo "$lt/objects"
> } >"$2/objects/info/alternates"
> 
> cd $2
> git-repack -a -d -s
> git-prune-packed
> ==================================================
> 
> I tried to modify git-clone to add an alternates file before calling
> fetch, but that file just gets deleted.
> 
> I presume I need to clone -s -l the local alternate, re-parent it to
> the new URL and grab anything missing, but how can I assure that it
> results in exactly the same repo as this script?

Exactly right.  There was some discussion about this perhaps just
two weeks back and it become clear that the easiest way to clone
through a thin straw is to use `git clone -s -l' from a locally
available repository which is ``close''[*1*] to the remote you are going
to actually trying to clone from, edit .git/remotes/origin to have
the correct URL: and Pull: lines, then `git-pull origin' to bring
down whatever you don't have yet.  This won't miss any objects so
it will result in the same repository as a clone would have[*2*].

Footnotes:

  [*1*] Here ``close'' means probably related to the same project.
  Meaning if you are cloning the Linux kernel at least start with
  another kernel repository and not say the GIT repository.  :-)
  The more your original repository has in common with the remote you
  are trying to pull from the less that will need to be downloaded.

  [*2*] This isn't entirely true.  During a normal clone everything
  is pulled down into a single pack. Using this strategy the missing
  objects that are downloaded will be loose; a git-repack after
  the pull might be a good idea to pull them into a pack.

-- 
Shawn.

  reply	other threads:[~2006-03-19 22:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-19 21:16 efficient cloning James Cloos
2006-03-19 22:31 ` Shawn Pearce [this message]
2006-03-19 23:18 ` Junio C Hamano
2006-03-20  0:32   ` James Cloos
2006-03-20  1:55     ` Junio C Hamano
2006-03-20  8:54       ` Junio C Hamano
2006-03-20 15:18         ` Petr Baudis
2006-03-20 21:39           ` Junio C Hamano
2006-03-20 22:41             ` Petr Baudis
2006-03-20 23:07               ` Junio C Hamano
2006-03-20 16:30         ` Josef Weidendorfer
2006-03-20 23:04           ` Junio C Hamano
2006-03-20 23:21             ` Petr Baudis
2006-03-20 23:49               ` Junio C Hamano
2006-03-21  8:19                 ` Andreas Ericsson
2006-03-21  8:42                   ` Junio C Hamano
2006-03-21  9:19                     ` Jeff King
2006-03-21  9:45                       ` Junio C Hamano
2006-03-21 11:29                         ` Petr Baudis
2006-03-21  0:26             ` Josef Weidendorfer
2006-03-21  0:57               ` Junio C Hamano
2006-03-21  8:28           ` Junio C Hamano

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=20060319223111.GA20464@spearce.org \
    --to=spearce@spearce.org \
    --cc=cloos@jhcloos.com \
    --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.