Subject: Re: [JGIT PATCH] Fixed a bug that caused tabs in ~/.ssh/config to break parsing

From: Jonas Fonseca <[email-masked]>
Date: Sun, 21 Sep 2008 00:29:58 +0200

Gilion Goudsmit <[email-masked]> wrote Sat, Sep 20, 2008:
> Having only tab-characters separating a key and value in the
> users ~/.ssh/config would cause the config-parser to fail with
> a "String index out of range: -1" exception. Also simplified
> the line parsing code my using a two argument split.
> 
> Signed-off-by: Gilion Goudsmit <[email-masked]>
> ---

With the following on top, the code will also pass the updated test for:

	Host	= somewhere

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java b/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java
index 5bfcf5f..a9c6c12 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java
@@ -167,7 +167,7 @@ public Host lookup(final String hostName) {
 			if (line.length() == 0 || line.startsWith("#"))
 				continue;
 
-			final String[] parts = line.split("[ \t=]", 2);
+			final String[] parts = line.split("[ \t]*[= \t]", 2);
 			final String keyword = parts[0].trim();
 			final String argValue = parts[1].trim();

-- 
Jonas Fonseca