From fe3874370b9204ec5a0a428f2f64a16dbba478b6 Mon Sep 17 00:00:00 2001 From: Marcus Jaschen Date: Tue, 24 May 2022 21:36:50 +0200 Subject: [PATCH] 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) --- recipe/deploy/update_code.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipe/deploy/update_code.php b/recipe/deploy/update_code.php index 50444de2..155404bc 100644 --- a/recipe/deploy/update_code.php +++ b/recipe/deploy/update_code.php @@ -72,8 +72,10 @@ task('deploy:update_code', function () { $git = get('bin/git'); $repository = get('repository'); $target = get('target'); + + $targetWithDir = $target; if (!empty(get('sub_directory'))) { - $target = "$target:{{sub_directory}}"; + $targetWithDir .= ':{{sub_directory}}'; } $bare = parse('{{deploy_path}}/.dep/repo'); @@ -100,7 +102,7 @@ task('deploy:update_code', function () { // Copy to release_path. 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') { cd('{{release_path}}'); run("$git clone -l $bare .");