git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Git Mailing list <git@vger.kernel.org>
Subject: Re: "git clone --shallow-exclude ...", fatal: the remote end hung up unexpectedly
Date: Sat, 16 Mar 2019 10:43:07 +0700	[thread overview]
Message-ID: <CACsJy8AxBr1AUwsPb6FZkJ5Pn9AfooW04Gz4fsdjF6VcP87g3w@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1903151027580.29322@localhost.localdomain>

On Fri, Mar 15, 2019 at 9:31 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>   also, i think "man git-clone" could really use a set of examples for
> shallow cloning. i'd offer to write it but i'm still figuring it out.

Cool. I'll give you a quick introduction to help with those examples :D

Side note: there's also narrow/lazy clone (or something with the
promisor) but I still haven't caught up with that. So none of that
here, but I think we should eventually have some examples/description.

A shallow clone is basically a repository with commit history cut
short. If you have a commit though, you have full content. It's not
cut by paths or anything.

"git clone --depth=X" the the normal way to do this. You get a
repository where all branches and tags have maximum X commits deep.
But since the main purpose of shallow clone is redude download,
--single-branch is made default when --depth is present, so you get
the default branch instead of all the branches (you would need
--no-single-branch for that). You could see these cut points with "git
log --decorate". I think they are marked "crafted" or something.

Once you have made a shallow clone, you could do everything like
usual. Local operations of course can only reach as far as the cut
points. Pull and push to a full clone are possible (it's even possible
to do so to another shallow clone).

When you "git fetch", the cut points remain the same, so you get more
recent commits and the history depth increases. If you do "git fetch
--depth=X" then the cut points are adjusted so that you only have
maximum X commits deep for all select branches, the same way a shallow
clone is made initially. "git fetch --unshallow" can be used to turn a
shallow clone into a complete one. And I'm pretty sure you could turn
a complete one to shallow with "git fetch --depth".

While --depth works fine most of the time, sometimes you want a
different way to define these shallow/cut points. --shallow-since and
--shallow-exclude are added as the result. --shallow-since cut the
history by a specific date (for all select branches).
--shallow-exclude cuts the history by a ref (often a tag). As I
mentioned before, it's mostly used to say "I want a shallow clone from
(but not including) v2.9.0".

And I think that's pretty much it. There's --update-shallow option but
I can't remember when that's needed. Shallow clones may also prevent
you from using some optional features. Pack bitmap is one of those and
I think probably commit graph too. It's not technical limitation, just
lack of time/effort to support them in shallow clones.
-- 
Duy

  reply	other threads:[~2019-03-16  3:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 12:14 "git clone --shallow-exclude ...", fatal: the remote end hung up unexpectedly Robert P. J. Day
2019-03-15 12:28 ` Duy Nguyen
2019-03-15 13:19   ` Robert P. J. Day
2019-03-15 13:41     ` Duy Nguyen
2019-03-15 14:31       ` Robert P. J. Day
2019-03-16  3:43         ` Duy Nguyen [this message]
2019-03-16 12:15           ` Robert P. J. Day

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=CACsJy8AxBr1AUwsPb6FZkJ5Pn9AfooW04Gz4fsdjF6VcP87g3w@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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).