You are here

function hackedProjectWebDevDownloader::git_clone in Hacked! 7.2

Clones a git repository in a temporary directory.

Parameters

$giturl: URL of the project.

$path: The location in which to place the checkout.

$branch: The branch to check out.

Return value

Either FALSE on failure or the location of the checked out files.

1 call to hackedProjectWebDevDownloader::git_clone()
hackedProjectWebDevDownloader::download in includes/hackedProjectWebDevDownloader.inc
Download the version of the project to compare.

File

includes/hackedProjectWebDevDownloader.inc, line 121

Class

hackedProjectWebDevDownloader
Downloads the dev version of a project.

Code

function git_clone($giturl, $path, $branch) {

  // Get the Git command and location information.
  $git_cmd = $this
    ->git_get_command();
  $dirname = dirname($path);
  $basename = basename($path);

  // Prepare the download location.
  file_prepare_directory($dirname, FILE_CREATE_DIRECTORY);
  file_prepare_directory($path, FILE_CREATE_DIRECTORY);

  // Perform the clone operation, and leave us in the appropriate branch.
  exec("cd {$dirname}; {$git_cmd} clone --branch {$branch} {$giturl} {$basename}", $output_lines, $return_value);

  // On success, return the path to the download, or FALSE otherwise.
  if ($return_value == 0) {
    return $path;
  }
  return FALSE;
}