mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
use git_cache also when --revision is defined
This commit is contained in:
parent
fa46d3f58f
commit
cd8941485d
@ -193,15 +193,14 @@ task('deploy:update_code', function () {
|
|||||||
// If option `tag` is not set and option `revision` is set
|
// If option `tag` is not set and option `revision` is set
|
||||||
if (empty($tag) && input()->hasOption('revision')) {
|
if (empty($tag) && input()->hasOption('revision')) {
|
||||||
$revision = input()->getOption('revision');
|
$revision = input()->getOption('revision');
|
||||||
|
if (!empty($revision)) {
|
||||||
|
$depth = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$releases = env('releases_list');
|
$releases = env('releases_list');
|
||||||
|
|
||||||
if (!empty($revision)) {
|
if ($gitCache && isset($releases[1])) {
|
||||||
// To checkout specified revision we need to clone all tree.
|
|
||||||
run("$git clone $at --recursive -q $repository {{release_path}} 2>&1");
|
|
||||||
run("cd {{release_path}} && $git checkout $revision");
|
|
||||||
} elseif ($gitCache && isset($releases[1])) {
|
|
||||||
try {
|
try {
|
||||||
run("$git clone $at --recursive -q --reference {{deploy_path}}/releases/{$releases[1]} --dissociate $repository {{release_path}} 2>&1");
|
run("$git clone $at --recursive -q --reference {{deploy_path}}/releases/{$releases[1]} --dissociate $repository {{release_path}} 2>&1");
|
||||||
} catch (RuntimeException $exc) {
|
} catch (RuntimeException $exc) {
|
||||||
@ -212,6 +211,10 @@ task('deploy:update_code', function () {
|
|||||||
// if we're using git cache this would be identical to above code in catch - full clone. If not, it would create shallow clone.
|
// if we're using git cache this would be identical to above code in catch - full clone. If not, it would create shallow clone.
|
||||||
run("$git clone $at $depth --recursive -q $repository {{release_path}} 2>&1");
|
run("$git clone $at $depth --recursive -q $repository {{release_path}} 2>&1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($revision)) {
|
||||||
|
run("cd {{release_path}} && $git checkout $revision");
|
||||||
|
}
|
||||||
})->desc('Updating code');
|
})->desc('Updating code');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user