mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 16:27:39 +01:00
Use correct Git ref spec when sub_directory
is specified. (#3138)
* Use correct Git ref spec when `sub_directory` is specified. The bug is described in detail in issue #3137. * change variable name for sub-directory target (as requested in PR)
This commit is contained in:
parent
764d3cd0b8
commit
fe3874370b
@ -72,8 +72,10 @@ task('deploy:update_code', function () {
|
|||||||
$git = get('bin/git');
|
$git = get('bin/git');
|
||||||
$repository = get('repository');
|
$repository = get('repository');
|
||||||
$target = get('target');
|
$target = get('target');
|
||||||
|
|
||||||
|
$targetWithDir = $target;
|
||||||
if (!empty(get('sub_directory'))) {
|
if (!empty(get('sub_directory'))) {
|
||||||
$target = "$target:{{sub_directory}}";
|
$targetWithDir .= ':{{sub_directory}}';
|
||||||
}
|
}
|
||||||
|
|
||||||
$bare = parse('{{deploy_path}}/.dep/repo');
|
$bare = parse('{{deploy_path}}/.dep/repo');
|
||||||
@ -100,7 +102,7 @@ task('deploy:update_code', function () {
|
|||||||
|
|
||||||
// Copy to release_path.
|
// Copy to release_path.
|
||||||
if (get('update_code_strategy') === 'archive') {
|
if (get('update_code_strategy') === 'archive') {
|
||||||
run("$git archive $target | tar -x -f - -C {{release_path}} 2>&1");
|
run("$git archive $targetWithDir | tar -x -f - -C {{release_path}} 2>&1");
|
||||||
} else if (get('update_code_strategy') === 'clone') {
|
} else if (get('update_code_strategy') === 'clone') {
|
||||||
cd('{{release_path}}');
|
cd('{{release_path}}');
|
||||||
run("$git clone -l $bare .");
|
run("$git clone -l $bare .");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user