Skip to content

Commit

Permalink
Drop the Git helper functions. The Git distribution approach is no lo…
Browse files Browse the repository at this point in the history
…nger being used.
  • Loading branch information
danielbachhuber committed May 12, 2013
1 parent ddeb1aa commit 25530fe
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions php/utils.php
Expand Up @@ -392,40 +392,3 @@ function run_mysql_command( $cmd, $arg_str, $pass ) {

if ( $r ) exit( $r );
}

/**
* Clone a Git repo into a directory
*
* @param string $clone_url Where the Git repo should be cloned from
* @param string $local_dir Where the local Git repo should live
* @return bool|WP_Error $result Output of the execution
*/
function git_clone( $clone_url, $local_dir ) {

$results = array();
exec( 'git clone ' . escapeshellarg( $clone_url ) . ' ' . $local_dir, $results, $return );

$git_result = array_pop( $results );
if ( false !== stripos( $git_result, 'Cloning into' ) )
return true;
else
return new \WP_Error( 'shell-fatal', $git_result );
}

/**
* Update a local Git repo
*
* @param string $local_dir Where the local Git repo lives
* @return bool|WP_Error $result Output of the execution
*/
function git_pull( $local_dir ) {

$results = array();
exec( 'cd ' . escapeshellarg( $local_dir ) . '; git pull origin master', $results, $return );

$git_result = array_pop( $results );
if ( false !== stripos( $git_result, 'Unpacking objects:' ) || false !== stripos( $git_result, 'Already up-to-date' ) )
return true;
else
return new \WP_Error( 'shell-fatal', $git_result );
}

0 comments on commit 25530fe

Please sign in to comment.