Permalink
Browse files

changed to remove space between key and value of short-form options (…

…refs #18270, thanks farazdagi!)
  • Loading branch information...
co3k committed Feb 13, 2011
1 parent 63945b1 commit d3b525610f28577685d4a3466fd7a40e7e4e3a70
Showing with 19 additions and 2 deletions.
  1. +4 −2 VersionControl/Git/Util/Command.php
  2. +15 −0 test/VersionControl_Git_Util_CommandTest.php
@@ -178,14 +178,16 @@ public function createCommandString($arguments = array(), $options = array())
continue;
}
if (1 === strlen($k)) {
$isShortOption = (1 === strlen($k));
if ($isShortOption) {
$command .= ' -'.$k;
} else {
$command .= ' --'.$k;
}
if (true !== $v) {
$command .= '='.escapeshellarg($v);
$command .= (($isShortOption) ? '' : '=').escapeshellarg($v);
}
}
@@ -186,4 +186,19 @@ public function testExecute()
$this->assertEquals(trim($result), 'b8adc7214881bb71b9741b5d8228ebf346197d47 initial commit');
}
public function testExecuteWithShortFormatOption()
{
$git = new VersionControl_Git('./fixtures/001_VersionControl_Git');
$i1 = new DummyGitCommand($git);
$result = $i1->setSubCommand('log')
->setOption('n', '1')
->setOption('pretty', 'oneline')
->setOption('grep', 'initial')
->execute();
$this->assertEquals($i1->getCommandString(), @System::which('git').' log -n\'1\' --pretty=\'oneline\' --grep=\'initial\'');
$this->assertEquals(trim($result), 'b8adc7214881bb71b9741b5d8228ebf346197d47 initial commit');
}
}

0 comments on commit d3b5256

Please sign in to comment.