Skip to content

Commit

Permalink
[BUGFIX] Added support for .ssh/config files indented with tabs or sp…
Browse files Browse the repository at this point in the history
…aces
  • Loading branch information
cmuench committed Aug 19, 2014
1 parent 0dac016 commit 77907e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Ssh/SshConfigFileConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ protected function parseSshConfigFile($file)
$configs = array();
$lineNumber = 1;
foreach (explode(PHP_EOL, $contents) as $line) {
if (trim($line) == '' || $line[0] == '#') {
$line = trim($line);
if ($line == '' || $line[0] == '#') {
continue;
}
$pos = strpos($line, '=');
Expand Down
4 changes: 2 additions & 2 deletions tests/Ssh/Fixtures/config_valid
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Port 1234
#This is a comment which won't appear in the parsed array

Host test
HostName test.com
HostName test.com

Host testuser.com
User test
Expand All @@ -21,4 +21,4 @@ IdentityFile ~/identity
Host ta*
User bob
Port = 12345
HostName test.com
HostName test.com

0 comments on commit 77907e4

Please sign in to comment.