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

Re: Completion message for git-clone?

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 8, 2008, 10:01 UTC
Message-ID
<m3ejbn4vis.fsf@localhost.localdomain>
In-Reply-To
<ad4f9af90802071909s4dad180as26b2dd8b7600342f@mail.gmail.com>
"Ian Dees" <undees@gmail.com> writes:
Show 12 quoted lines
> Hi, all.  Upon cloning a repository, the initial message reads:
> 
>   Initialized empty Git repository in path/to/new-repo/.git
>   0 blocks
> 
> I'd wager "empty" means, "empty because Git is about to populate it."
> Even so, this wording could be a bit surprising to new adopters,
> especially coupled with the "0 blocks" suffix (is it really creating
> hardlinks on NTFS?).  The impression is that the clone didn't work.
> The impression is, of course, eventually dispelled by looking inside
> the new directory.  Is there a way to clarify the overall status of
> the clone operation?

This is caused by the fact that for now git-clone is a shell script, which creates empty repository using git-init (The "Initialized..." message is from git-init), then configures it and populates it. For local clones it uses cpio for hardlinking: the "0 blocks" is from cpio.

It shouldn't be hard to add message which would confirm successful completion of the clone if it is local clone; the messages from git-fetch are I think enough indication that clone succeeded... but perhaps we would want to add final message anyway.

Nevertheless git-clone waits to be rewritten in C anyway, so
there is no much initiative to improve shell version. The stumbling
blocks are as far as I can remember moving detection of which branch
is currently checked out to git-remote, and optionally adding
symbolic-ref extension to git transfer protocol for git to not have to
guess which branch is HEAD.
 
Show 6 quoted lines
> One other minor thing I noticed while futzing with clones: if you try
> to clone an empty repository, you get the same "Initialized empty
> repository" message, even though no such second directory is created.
> I'm not suggesting Git should suddenly start allowing empty cloning,
> but perhaps a "Empty repository; skipping clone" message would be
> helpful.

$ git clone a b Initialized empty Git repository in /tmp/b/.git/ fatal: cannot clone empty repository $ git --version git version 1.5.4

Perhaps git should check if there is anything to clone _before_ git-init, or do not remove empty directory after failing to fetch.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Jeff KingNext: Ian Dees
Message 3 of 4 in “Completion message for git-clone?”
  1. Ian DeesFeb 8, 2008
  2. Jeff KingFeb 8, 2008
  3. Jakub NarebskiFeb 8, 2008
  4. Ian DeesFeb 8, 2008

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.