git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, mst@redhat.com, Jens.Lehmann@web.de
Subject: Re: [PATCH 0/6] git clone: Marry --recursive and --reference
Date: Fri, 05 Aug 2016 12:47:26 -0700	[thread overview]
Message-ID: <xmqqoa57vvzl.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160804195159.7788-1-sbeller@google.com> (Stefan Beller's message of "Thu, 4 Aug 2016 12:51:53 -0700")

Stefan Beller <sbeller@google.com> writes:

>  Currently when cloning a superproject with --recursive and --reference
>  only the superproject learns about its alternates. The submodules are
>  cloned independently, which may incur lots of network costs.
>  
>  Assume that the reference repository has the submodules at the same
>  paths as the to-be-cloned submodule and try to setup alternates from
>  there.

I am a bit fuzzy about what scenario you are trying to help.  Is it
something like this? [*1*]

 * The superproject is at git://frotz.xz/super.git but you locally
   have a mirror at /var/cache/super.git (bare) repository.

 * "git clone --refererence /var/cache/super.git git://frotz.xz/super.git"
   would borrow that existing local mirror to cut down the traffic.

 * The super.git project uses git://nitfol.xz/xyzzy.git as its
   submodule.  You locally have a mirror of it at
   /var/cache/xyzzy.git (bare) repository.

 * The xyzzy submodule is bound at libs/xyzzy in the superproject
   tree.

 * You want the "clone" command above with "--recursive" to do "the
   right thing".  That is, the clone of the superproject borrows
   from /var/cache/super.git local mirror, and the clone of xyzzy
   that would be made at .git/modules/xyzzy in the superproject
   would borrow from /var/cache/xyzzy.git local mirror.

What I am not sure about is how /var/cache/xyzzy.git should be
automatically derived from the information given from the command
line of "clone" and what the clone of the superproject contains.
You'd need to make certain assumptions, like

 - The parent directory of the --reference for superproject,
   i.e. /var/cache/, is the directry that has many other mirrors;

 - The .gitmodules file in superproject says a "xyzzy" project from
   git://nitfol.xz/xyzzy.git must be checked out at "libs/xyzzy",
   and it is a reasonable assumption that we would find a local
   mirror at /var/cache/xyzzy.git (the /var/cache prefix comes from
   the above assumptino).

There may be some other assumptions you are making.  I am wondering
if your specific assumption is applicable generally.


[Footnote]

*1* Another common arrangement could be that you have one full clone
    of the superproject at /var/cache/super.git and its submodule
    xyzzy in /var/cache/super.git/modules/xyzzy and assuming that
    would allow you to guess where to borrow submodules from.  But
    the result of assuming this layout would already be different
    from the scenario I gave the above.  If the organization uses
    the xyzzy project only in the context of the frotz superproject,
    "borrow from submodule repository inside $GIT_DIR/modules/ of
    the superproject" may be sensible, but that makes use of "xyzzy"
    as an independent project quite awkward (also you may have
    another superproject that is unrelated to super.git that uses
    the same "xyzzy" project as its submodule).  The more "xyzzy"
    project is suitable to be used as "submodule", the more it makes
    sense to have its mirror independent from the superprojects that
    use it, by using /var/cache/{super,xyzzy}.git layout.

    IOW, both layouts are equally sensible; what layout (either one
    of the above two, or something entirely different) is your "at
    the same paths" assumption meant to serve well, and what is the
    plan to serve other layouts?




  parent reply	other threads:[~2016-08-05 19:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 19:51 [PATCH 0/6] git clone: Marry --recursive and --reference Stefan Beller
2016-08-04 19:51 ` [PATCH 1/6] t7408: modernize style Stefan Beller
2016-08-05 20:30   ` Junio C Hamano
2016-08-04 19:51 ` [PATCH 2/6] t7408: merge short tests, factor out testing method Stefan Beller
2016-08-05 20:45   ` Junio C Hamano
2016-08-05 22:45     ` Stefan Beller
2016-08-05 23:09       ` Junio C Hamano
2016-08-04 19:51 ` [PATCH 3/6] submodule--helper module-clone: allow multiple references Stefan Beller
2016-08-05 20:54   ` Junio C Hamano
2016-08-04 19:51 ` [PATCH 4/6] submodule--helper update-clone: " Stefan Beller
2016-08-05 19:08   ` Stefan Beller
2016-08-05 21:06     ` Junio C Hamano
2016-08-05 21:19       ` Stefan Beller
2016-08-05 21:31         ` Junio C Hamano
2016-08-05 21:33           ` Stefan Beller
2016-08-04 19:51 ` [PATCH 5/6] submodule update: add super-reference flag Stefan Beller
2016-08-05 21:16   ` Junio C Hamano
2016-08-06  0:22     ` Stefan Beller
2016-08-04 19:51 ` [PATCH 6/6] clone: reference flag is used for submodules as well Stefan Beller
2016-08-05 21:36   ` Junio C Hamano
2016-08-05 19:47 ` Junio C Hamano [this message]
2016-08-05 21:23   ` [PATCH 0/6] git clone: Marry --recursive and --reference Stefan Beller
2016-08-05 21:47     ` Junio C Hamano
2016-08-05 23:26 ` Rename detection within in files WAS: [PATCH 2/6] t7408: merge short tests, factor out testing method Stefan Beller
2016-08-07  9:24   ` René Scharfe

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqoa57vvzl.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=sbeller@google.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).