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

[JGIT PATCH 4/5] Report remote SSH execution errors during push via TransportException

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 10, 2008, 06:13 UTC
Message-ID
<1215670403-19191-5-git-send-email-spearce@spearce.org>
In-Reply-To
<1215670403-19191-4-git-send-email-spearce@spearce.org>

If the remote side failed to execute git-receive-pack we may have the reason why on the stderr stream of the channel, as the remote shell may have failed execution.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../spearce/jgit/transport/TransportGitSsh.java    |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
index b169f4c..9a6c719 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
@@ -228,7 +228,7 @@ class TransportGitSsh extends PackTransport {
 				if (channel.isConnected())
 					init(channel.getInputStream(), channel.getOutputStream());
 				else
-					throw new TransportException(errStream.toString());
+					throw new TransportException(uri, errStream.toString());
 
 			} catch (TransportException err) {
 				close();
@@ -263,7 +263,12 @@ class TransportGitSsh extends PackTransport {
 			super(TransportGitSsh.this);
 			try {
 				channel = exec(getOptionReceivePack());
-				init(channel.getInputStream(), channel.getOutputStream());
+
+				if (channel.isConnected())
+					init(channel.getInputStream(), channel.getOutputStream());
+				else
+					throw new TransportException(uri, errStream.toString());
+
 			} catch (TransportException err) {
 				close();
 				throw err;
-- 
1.5.6.2.393.g45096
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 5 of 12 in “Yet another round of transport fixes”
  1. 0/5 Yet another round of transport fixesShawn O. Pearce, Jul 10, 2008
  2. 1/5 Include a progress meter for large uploads to Amazon S3Shawn O. Pearce, Jul 10, 2008
  3. 2/5 Don't display passwords on the console in fetch/push outputShawn O. Pearce, Jul 10, 2008
  4. 3/5 Reuse the same SSH connection when automatically fetching tagsShawn O. Pearce, Jul 10, 2008
  5. 4/5 Report remote SSH execution errors during push via TransportExceptionShawn O. Pearce, Jul 10, 2008
  6. 5/5 Explicitly capture the stderr from a failed SSH fetch or pushShawn O. Pearce, Jul 10, 2008
  7. Robin RosenbergJul 10, 2008
  8. Robin RosenbergJul 10, 2008
  9. Johannes SchindelinJul 10, 2008
  10. Robin RosenbergJul 10, 2008
  11. Shawn O. PearceJul 11, 2008
  12. Robin RosenbergJul 11, 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.