Skip to content

Commit aeca742

Browse files
committed
Made Repository::run simpler
And I changed the format or the log line of 'run command ...' To be able to copy/past the log line and execute the command.
1 parent 6fb4f56 commit aeca742

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Gitonomy/Git/Repository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,16 +514,16 @@ public function run($command, $args = array())
514514
{
515515
$process = $this->getProcess($command, $args);
516516

517-
if (null !== $this->logger) {
518-
$this->logger->info(sprintf('run command: %s "%s" ', $command, implode('", "', $args)));
517+
if ($this->logger) {
518+
$this->logger->info(sprintf('run command: %s "%s" ', $command, implode(' ', $args)));
519519
$before = microtime(true);
520520
}
521521

522522
$process->run();
523523

524524
$output = $process->getOutput();
525525

526-
if (null !== $this->logger && true === $this->debug) {
526+
if ($this->logger && $this->debug) {
527527
$duration = microtime(true) - $before;
528528
$this->logger->debug(sprintf('last command (%s) duration: %sms', $command, sprintf('%.2f', $duration*1000)));
529529
$this->logger->debug(sprintf('last command (%s) return code: %s', $command, $process->getExitCode()));
@@ -533,11 +533,11 @@ public function run($command, $args = array())
533533
if (!$process->isSuccessful()) {
534534
$error = sprintf("error while running %s\n output: \"%s\"", $command, $process->getErrorOutput());
535535

536-
if (null !== $this->logger) {
536+
if ($this->logger) {
537537
$this->logger->error($error);
538538
}
539539

540-
if (true === $this->debug) {
540+
if ($this->debug) {
541541
throw new RuntimeException($process);
542542
}
543543

0 commit comments

Comments
 (0)