git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sverre Rabbelier <srabbelier@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] Allow cloning an empty repository
Date: Fri, 23 Jan 2009 02:46:42 +0100	[thread overview]
Message-ID: <bd6139dc0901221746h258f548etf857ab37399133da@mail.gmail.com> (raw)
In-Reply-To: <7vwscm4xx0.fsf@gitster.siamese.dyndns.org>

On Fri, Jan 23, 2009 at 02:24, Junio C Hamano <gitster@pobox.com> wrote:
> I think the basic idea is Ok, but is it a reliable check at this point to
> see if (refs == NULL) to tell if the target repository is an empty one?

This is the question I asked Dscho, and he said/guessed that it was.

> I am mostly worried about a failure case (connected but couldn't get the
> refs, or perhaps connection failed to start).  If you get a NULL in such a
> case you may end up saying "oh you cloned a void" when you should say
> "nah, such a remote repository does not exist".

Yes, this was my concern as well.

> If transport_get_remote_refs() dies without returning NULL, that would be
> sufficient, but I didn't check.

It does, transport_get_remote_refs() calls fetch_pack, which dies when
'refs' (the fourth argument) is NULL:

static int fetch_refs_via_pack(...) {
// setup code snipped
	if (!data->conn) {
		connect_setup(transport);
		get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0, NULL);
	}

	refs = fetch_pack(&args, data->fd, data->conn,
			  refs_tmp ? refs_tmp : transport->remote_refs,
			  dest, nr_heads, heads, &transport->pack_lockfile);

So unless get_remote_heads messes with it, it will remain NULL. Now I
must admit that I'm not familiar enough with get_remote_heads to know
if this could cause a false positive, Dscho?

-- 
Cheers,

Sverre Rabbelier

  reply	other threads:[~2009-01-23  1:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23  0:07 [PATCH] Allow cloning an empty repository Sverre Rabbelier
2009-01-23  1:24 ` Junio C Hamano
2009-01-23  1:46   ` Sverre Rabbelier [this message]
2009-01-23  2:42     ` Johannes Schindelin
2009-01-23  2:47       ` Sverre Rabbelier
2009-01-23  3:20         ` Johannes Schindelin
2009-01-23 16:55           ` Miklos Vajna
2009-01-23 20:05             ` Johannes Schindelin
2009-01-23 22:32           ` Jeff King
2009-01-23 22:34             ` Sverre Rabbelier
2009-01-23 22:37               ` Jeff King
2009-01-23 22:39                 ` Sverre Rabbelier
2009-01-24  0:28                 ` Johannes Schindelin
2009-01-23 21:55       ` Mike Hommey
2009-01-24  0:26         ` http fixes, was " Johannes Schindelin
2009-01-24  9:39           ` Sverre Rabbelier
2009-01-23 23:05       ` Miklos Vajna
2009-01-24  0:33         ` Johannes Schindelin
2009-01-24  0:42           ` Sverre Rabbelier
2009-01-25  0:49             ` Miklos Vajna
2009-01-25  0:55               ` Sverre Rabbelier
2009-01-25  5:05                 ` Junio C Hamano
2009-01-25 18:33                   ` Sverre Rabbelier

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

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

  git send-email \
    --in-reply-to=bd6139dc0901221746h258f548etf857ab37399133da@mail.gmail.com \
    --to=srabbelier@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).