function hackedProjectWebDevDownloader::git_checkout in Hacked! 7.2
Checks out the last Git commit prior to the project's timestamp.
Parameters
$path: The path of the Git repository where the checkout should happen.
$branch: The desired branch within the repository containing the commit.
$timestamp: The UNIX timestamp for the downloaded project.
Return value
Either FALSE on failure or the location of the checked out files.
1 call to hackedProjectWebDevDownloader::git_checkout()
- hackedProjectWebDevDownloader::download in includes/
hackedProjectWebDevDownloader.inc - Download the version of the project to compare.
File
- includes/
hackedProjectWebDevDownloader.inc, line 154
Class
- hackedProjectWebDevDownloader
- Downloads the dev version of a project.
Code
function git_checkout($path, $branch, $timestamp) {
// Fetch the Git command.
$git_cmd = $this
->git_get_command();
// Point the working tree at the commit just before the timestamp.
// This takes us to the point in time when the local project was downloaded.
exec("cd {$path}; {$git_cmd} checkout \$({$git_cmd} rev-list -n 1 --before='{$timestamp}' {$branch})", $output_lines, $return_value);
// On success, return the path to the download, or FALSE otherwise.
if ($return_value == 0) {
return $path;
}
return FALSE;
}