git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Zawirski <marek.zawirski@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: robin.rosenberg@dewire.com, git@vger.kernel.org
Subject: Re: [EGIT PATCH 1/3] Give NoRemoteRepositoryException better message in BasePackConnection
Date: Thu, 28 Aug 2008 04:40:22 +0200	[thread overview]
Message-ID: <48B61016.7050401@gmail.com> (raw)
In-Reply-To: <20080828023501.GC8624@spearce.org>

Shawn O. Pearce wrote:
(...)
> +	@Override
> +	protected TransportException noRepository() {
> +		// Sadly we cannot tell the "invalid URI" case from "push not allowed".
> +		// Opening a fetch connection can help us tell the difference, as any
> +		// useful repository is going to support fetch if it also would allow
> +		// push. So if fetch throws NoRemoteRepositoryException we know the
> +		// URI is wrong. Otherwise we can correctly state push isn't allowed
> +		// as the fetch connection opened successfully.
> +		//
> +		try {
> +			transport.openFetch().close();
> +		} catch (NotSupportedException e) {
> +			// Fall through.
> +		} catch (NoRemoteRepositoryException e) {
> +			// Fetch concluded the repository doesn't exist.
> +			//
> +			return e;
> +		} catch (TransportException e) {
> +			// Fall through.
> +		}
> +		return new TransportException(uri, "push not permitted");
> +	}
> +

Nice idea, even if it's crazy and time-consuming, it's probably better 
than my previous one.

-- 
Marek Zawirski [zawir]
marek.zawirski@gmail.com

  reply	other threads:[~2008-08-28  2:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28  1:36 [EGIT PATCH 1/3] Give NoRemoteRepositoryException better message in BasePackConnection Marek Zawirski
2008-08-28  1:36 ` [EGIT PATCH 2/3] Handle NoRemoteRepositoryException in PushOperation especially Marek Zawirski
2008-08-28  1:36   ` [EGIT PATCH 3/3] Show ErrorDialog fot fatal connection errors in ConfirmationPage Marek Zawirski
2008-08-28  2:21     ` Shawn O. Pearce
2008-08-28  2:30       ` Marek Zawirski
2008-08-28  2:19   ` [EGIT PATCH 2/3] Handle NoRemoteRepositoryException in PushOperation especially Shawn O. Pearce
2008-08-28  2:29     ` Marek Zawirski
2008-08-28  2:35 ` [EGIT PATCH 1/3] Give NoRemoteRepositoryException better message in BasePackConnection Shawn O. Pearce
2008-08-28  2:40   ` Marek Zawirski [this message]
2008-08-28  2:44     ` Shawn O. Pearce

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=48B61016.7050401@gmail.com \
    --to=marek.zawirski@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --cc=spearce@spearce.org \
    /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).