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

Re: [PATCHv2 0/6] git clone: Marry --recursive and --reference

From
Stefan Beller <sbeller@google.com>
Date
Aug 8, 2016, 18:16 UTC
Message-ID
<CAGZ79kYryZkMNj3_OLBU_fq-wmc+6a3ZmNSXrwVBB1jAz8Sc0Q@mail.gmail.com>
In-Reply-To
<xmqqd1lliz5k.fsf@gitster.mtv.corp.google.com>
On Sat, Aug 6, 2016 at 10:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>>  Some submodules in the referenced superproject may not be there,
>>  (they are just not initialized/cloned/checked out), which yields
>>  an error for now.
>
> Perhaps you can teach "git clone --reference" an new option
> (--reference-if-able) to do this?  Then
>
>     When `--reference` is given together with `--recursive`,
>     the reference repository is assumed to contain the submodules
>     as well and the submodules are setup as alternates of the
>     submodules in the given reference project.
>
> in which "assumed" is a horrible wording (leave the reader
> wondering: "so what happens to my data when the assumption does not
> hold") can become a lot more reasonable
>
>     When using --reference with --recursive, the --reference is used
>     to specify a repository that has a copy of the superproject.  If
>     that copy has submodules cloned for itself in its $GIT_DIR/modules,
>     they are used as --reference when cloning submodules in the
>     resulting clone.
>
> and readers expectation would match with the reality.  Their
> submodules would be cloned in a regular fashion if the central
> mirror does not have it, and would take advantage of it if there is
> already a clone.
That makes sense.
Show 17 quoted lines
>
> Come to think of it, do we even need --super-reference?  "git clone
> --reference --recursive" is a two step process, in that first the
> superproject is cloned while creating objects/info/alternates, and
> then submodules are cloned (via "update --init").  Can we make the
> procedure to clone a submodule always look at the reference of the
> superproject (i.e. objects/info/alternates) and try to borrow from
> the place in it that corresponds to the submodule?  That way, not
> just "git clone --reference --recursive" would take advantage of the
> existing mirrors of submodules, a user who does this:
>
>     $ git clone --reference $URL super
>     $ cd super
>     $ git submodule update --init ...
>
> would be able to take advantage of the "what the mirror the
> superproject uses already has" when cloning the submodules, no?
That would work, too.
I'll implement that.

Thanks, Stefan

Previous: Junio C HamanoNext: Stefan Beller
Message 3 of 12 in “[PATCHv2 0/6] git clone: Marry --recursive and --reference”
  1. Stefan BellerAug 6, 2016
  2. Junio C HamanoAug 6, 2016
  3. Stefan BellerAug 8, 2016
  4. 2/6 t7408: merge short tests, factor out testing methodStefan Beller, Aug 6, 2016
  5. Junio C HamanoAug 6, 2016
  6. 3/6 submodule--helper module-clone: allow multiple referencesStefan Beller, Aug 6, 2016
  7. 4/6 submodule--helper update-clone: allow multiple referencesStefan Beller, Aug 6, 2016
  8. Junio C HamanoAug 6, 2016
  9. 1/6 t7408: modernize styleStefan Beller, Aug 6, 2016
  10. 6/6 clone: reference flag is used for submodules as wellStefan Beller, Aug 6, 2016
  11. 5/6 submodule update: add super-reference flagStefan Beller, Aug 6, 2016
  12. Junio C HamanoAug 6, 2016

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.