Disambiguate "push not supported" from "repository not found"
commitb4cd065813ba6107a7fcff87d9af58957f35e63a
authorShawn O. Pearce <spearce@spearce.org>
Fri, 29 Aug 2008 00:18:38 +0000 (28 17:18 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Tue, 2 Sep 2008 17:47:14 +0000 (2 19:47 +0200)
tree1d35dc7b711232d05796ba0140a680ec5f1f5a99
parente8634851f46e1b54db17a45a9008b6e6284f34ce
Disambiguate "push not supported" from "repository not found"

If we are pushing to a remote repository the reason why we
get no refs may be because push is not permitted, or it is
a bad URI and points to a non-existant repository.

To get a good error message for the user we need to open a
fetch connection to see if fetch also fails.  If it failed
we know the URI is invalid; if fetch succeeds we know that
the repository is there but the user is just not allowed to
push to it over this transport.

With this change we now get useful error messages:

  $ ./jgit.sh push git://repo.or.cz/egit.git refs/heads/master
  fatal: git://repo.or.cz/egit.git: push not permitted

  $ ./jgit.sh push git://repo.or.cz/fake.git refs/heads/master
  fatal: git://repo.or.cz/fake.git: not found.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
hhghgh
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackConnection.java
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackPushConnection.java