38 public static function init($directory, array $params = NULL){
39 if(is_dir(
"$directory/.git")){
40 throw new GitException(
"Repo already exists in $directory.");
43 if(!is_dir($directory) && !@mkdir($directory, 0777, TRUE)){
44 throw new GitException(
"Unable to create directory '$directory'.");
49 exec(self::processCommand(array(
53 )), $output, $returnCode);
55 if($returnCode !== 0){
56 throw new GitException(implode(
"<br>", $output));
61 return new static($repo);
67 $programName = array_shift ( $args );
69 foreach ( $args as $arg ) {
70 if (is_array ( $arg )) {
71 foreach ( $arg as $key => $value ) {
74 if (is_string ( $key )) {
77 if (is_array ( $value )) {
78 foreach ( $value as $v ) {
79 $cmd [] = $_c . escapeshellarg ( $v );
82 $cmd [] = $_c . escapeshellarg ( $value );
85 } elseif (is_scalar ( $arg ) && ! is_bool ( $arg )) {
86 $cmd [] = escapeshellarg ( $arg );
89 return "$programName " . implode (
' ', $cmd );
181 return $this->extractFromCommand (
'git log --pretty=format:"%h___%an___%ar___%s___%H"',
function ($str) use ($nonPushed,$remoteBranchsSize) {
182 $array = \explode (
"___", $str );
184 if($remoteBranchsSize==0){
187 if (\is_array ( $nonPushed ))
188 $pushed = ! in_array ( $array [0], $nonPushed );
190 return new GitCommit ( $array [0], $array [1], $array [2], $array [3], $array [4], $pushed );
192 }
catch ( \Cz\Git\GitException $e ) {