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

Re: "git clone --shallow-exclude ...", fatal: the remote end hung up unexpectedly

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 15, 2019, 12:28 UTC
Message-ID
<CACsJy8DVRJ4DG6PEkFuzytOQJ7RX6GMaHd4BRQTR9N7Y9V6fqQ@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.21.1903150809070.26709@localhost.localdomain>
On Fri, Mar 15, 2019 at 7:17 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
Show 17 quoted lines
>
>
>   probably doing something idiotic but i'm enumerating variations of
> shallow cloning, and tried the following:
>
> $ git clone --shallow-exclude=master https://github.com/django/django.git
> Cloning into 'django'...
> fatal: the remote end hung up unexpectedly
> $
>
>   it is entirely reproducible, and some googling suggests that this
> represents an error at the *other* end, which in some weird way does
> not support that clone option. that seems strange ... should this
> option work? am i using it incorrectly?
>
>   wait, hang on ... i just picked one of django's topic branches at
> random, and this did succeed:

Yeah i think when you request shallow clone, by default it only gets one branch (see --single-branch, often 'master'). So when you specify --shallow-exclude you essentially say 'give me master branch but exclude everything from master'.

I should probably make it print a friendlier message than simply terminateing like that (it's still a guess, I haven't tried it out)

Show 9 quoted lines
> $ git clone --shallow-exclude=stable/2.0.x https://github.com/django/django.git
> Cloning into 'django'...
> remote: Enumerating objects: 33112, done.
> remote: Counting objects: 100% (33112/33112), done.
> ... etc etc ...
> $
>
> but all this gave me was the master branch. i clearly don't understand
> what this option is supposed to do.

You're saying 'give me master branch, exclude everything that is reachable from stable/2.0.x'. If there's nothing in common between master and this branch, you get full 'master' branch. Otherwise you get a shallow 'master' branch.

This option is meant to give you another way to cut the history. Instead of saying 'give me X latest commits' with --shallow, you could say 'give me commits since this cut point' and the cut point is often a tag, on the same branch. Using an unrelated bracnh or tag could give some surprising result.

-- 
Duy
Previous: Robert P. J. DayNext: Robert P. J. Day
Message 2 of 7 in “"git clone --shallow-exclude ...", fatal: the remote end hung up unexpectedly”
  1. Robert P. J. DayMar 15, 2019
  2. Duy NguyenMar 15, 2019
  3. Robert P. J. DayMar 15, 2019
  4. Duy NguyenMar 15, 2019
  5. Robert P. J. DayMar 15, 2019
  6. Duy NguyenMar 16, 2019
  7. Robert P. J. DayMar 16, 2019

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.