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

Re: [PATCH] Take care of errors reported from the server when upload command is started

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 22, 2008, 23:01 UTC
Message-ID
<20080622230159.GG11793@spearce.org>
In-Reply-To
<1214156797-29186-1-git-send-email-robin.rosenberg@dewire.com>
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> @@ -44,4 +46,31 @@ class EclipseSshSessionFactory extends SshSessionFactory {
> +	@Override
> +	public OutputStream getErrorStream() {
...
> +					Activator.logError(s, new Throwable());

I'm not sure what value the Throwable gives us here; it may be some call stack deep within JSch, isn't it? Is it useful to include?

We may also want the log records in Eclipse to say which remote the message came from, which means passing in the URIish as a parameter.

Show 5 quoted lines
> @@ -77,6 +78,7 @@ class TransportGitSsh extends PackTransport {
>  	}
>  
>  	final SshSessionFactory sch;
> +	OutputStream errStream;
Could we avoid putting the error stream as an instance member
of the transport by instead using channel.getErrStream() in the
exception case below?
  
Show 6 quoted lines
> @@ -179,7 +181,8 @@ class TransportGitSsh extends PackTransport {
>  			cmd.append(' ');
>  			sqAlways(cmd, path);
>  			channel.setCommand(cmd.toString());
> -			channel.setErrStream(System.err);
> +			errStream = SshSessionFactory.getInstance().getErrorStream();

Use sch rather than SshSessionFactory.getInstance(). We store it in the transport so that once the transport instance is created it always goes to the same SshSessionFactory for anything it needs, even if the caller has changed the global SshSessionFactory away on us.

Show 10 quoted lines
> @@ -198,7 +201,12 @@ class TransportGitSsh extends PackTransport {
>  			try {
>  				session = openSession();
>  				channel = exec(session, getOptionUploadPack());
> -				init(channel.getInputStream(), channel.getOutputStream());
> +
> +				if (channel.isConnected())
> +					init(channel.getInputStream(), channel.getOutputStream());
> +				else
> +					throw new TransportException(errStream.toString());

I think you can say channel.getErrStream() here and not need the instance member.

-- 
Shawn.
Previous: Robin RosenbergNext: Robin Rosenberg
Message 5 of 8 in “Paper bag fix quoting for SSH transport commands”
  1. Paper bag fix quoting for SSH transport commandsShawn O. Pearce, Jun 22, 2008
  2. Take care of errors reported from the server when upload command is startedRobin Rosenberg, Jun 22, 2008
  3. Clone: Handle cancel in clone dialog speciallyRobin Rosenberg, Jun 22, 2008
  4. Clone: If url is changed was changed, forget the old valueRobin Rosenberg, Jun 22, 2008
  5. Shawn O. PearceJun 22, 2008
  6. Robin RosenbergJun 22, 2008
  7. Shawn O. PearceJun 22, 2008
  8. Robin RosenbergJun 23, 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.