Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merged branch jrschumacher/master (PR #72)

Commits
-------

fcce354 fix git checkout bug through suppression

Discussion
----------

Fix git checkout bug :: git checkout returns STDERR instead of STDOUT

When building a project stderr is returned by git when it intends stdout. Following command prints to stderr and causes error
```
$ git checkout 'origin/master'
    HEAD is now at 43329a9... update MongoRecord
```

Dumping $process
```` php
// Builder.php::execute() | var_dump($process);
object(Symfony\Component\Process\Process)#159 (16) {
  ["commandline":"Symfony\Component\Process\Process":private]=>
  string(28) "git checkout 'origin/master'"
  ["cwd":"Symfony\Component\Process\Process":private]=>
  string(36) "/Users/Ryan/.sismo/data/build/ac1276"
  ["env":"Symfony\Component\Process\Process":private]=>
  NULL
  ["stdin":"Symfony\Component\Process\Process":private]=>
  NULL
  ["timeout":"Symfony\Component\Process\Process":private]=>
  int(3600)
  ["options":"Symfony\Component\Process\Process":private]=>
  array(2) {
    ["suppress_errors"]=>
    bool(true)
    ["binary_pipes"]=>
    bool(true)
  }
  ["exitcode":"Symfony\Component\Process\Process":private]=>
  int(0)
  ["processInformation":"Symfony\Component\Process\Process":private]=>
  array(8) {
    ["command"]=>
    string(28) "git checkout 'origin/master'"
    ["pid"]=>
    int(61774)
    ["running"]=>
    bool(false)
    ["signaled"]=>
    bool(false)
    ["stopped"]=>
    bool(false)
    ["exitcode"]=>
    int(0)
    ["termsig"]=>
    int(0)
    ["stopsig"]=>
    int(0)
  }
  ["stdout":"Symfony\Component\Process\Process":private]=>
  string(0) ""
  ["stderr":"Symfony\Component\Process\Process":private]=>
  string(45) "HEAD is now at 43329a9... update MongoRecord
"
  ["enhanceWindowsCompatibility":"Symfony\Component\Process\Process":private]=>
  bool(true)
  ["pipes":"Symfony\Component\Process\Process":private]=>
  array(0) {
  }
  ["process":"Symfony\Component\Process\Process":private]=>
  resource(23) of type (Unknown)
  ["status":"Symfony\Component\Process\Process":private]=>
  string(10) "terminated"
  ["fileHandles":"Symfony\Component\Process\Process":private]=>
  NULL
  ["readBytes":"Symfony\Component\Process\Process":private]=>
  NULL
}
````

Surprisingly adding `git checkout -q 'origin/master'` will suppress that error yet still return stderr. After browsing the net there are a number of issues where git uses stderr instead of stdout.

---------------------------------------------------------------------------

by jrschumacher at 2012-08-06T20:59:14Z

This will need others to test and look into to determine if it has to do with my version of git.

---------------------------------------------------------------------------

by fabpot at 2012-08-07T05:59:17Z

`-g` is not a valid switch for `checkout` (at least, not for me: git version 1.7.11.3).

---------------------------------------------------------------------------

by jrschumacher at 2012-08-08T18:53:28Z

Sorry that was a typo meant `git checkout -q`
  • Loading branch information...
commit 6517c58bfa1d2493872625a86401031e84cf1921 2 parents 6d357d1 + fcce354
@fabpot fabpot authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/Sismo/Builder.php
View
2  src/Sismo/Builder.php
@@ -36,7 +36,7 @@ public function __construct($buildDir, $gitPath, array $gitCmds)
'clone' => 'clone --progress --recursive %repo% %dir% --branch %localbranch%',
'fetch' => 'fetch origin',
'prepare' => 'submodule update --init --recursive',
- 'checkout' => 'checkout %branch%',
+ 'checkout' => 'checkout -q %branch%',
'reset' => 'reset --hard %revision%',
'show' => 'show -s --pretty=format:%format% %revision%',
), $gitCmds);
Please sign in to comment.
Something went wrong with that request. Please try again.