Skip to content

Commit

Permalink
Clean up deploy task: too much git show.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpugh committed Nov 21, 2019
1 parent 8adb506 commit b9be304
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,29 @@ function drush_devshop_provision_provision_devshop_deploy($git_ref = '')
// $git->command('stash');

// Fetch
provision_process("git fetch origin", d()->platform->repo_path, dt('DevShop Deploy'));
drush_log('[Current Working Directory]' . d()->platform->repo_path, 'p_log');

provision_process("git show", d()->platform->repo_path, dt('Pre-deploy git status'));
provision_process("git fetch origin", d()->platform->repo_path, dt('DevShop Deploy: Fetch Changes'));
provision_process("git status", d()->platform->repo_path, dt('DevShop Deploy: Git Status'));

// Checkout the chosen ref
$git_checkout_output = provision_process("git checkout {$git_ref}", d()->platform->repo_path, dt('DevShop Deploy'));
$git_checkout_output = provision_process("git checkout {$git_ref}", d()->platform->repo_path, dt('DevShop Deploy: Checkout Code'));
$git_checkout_output_lines = explode("\n", $git_checkout_output);
$git_ref_type = devshop_environment_get_git_ref_type(d()->platform->repo_path);

drush_log('[Current Working Directory]' . d()->platform->repo_path, 'p_log');
drush_log("[Git $git_ref_type to Deploy] $git_ref", 'p_log');

// If the current working copy was detected to be a branch, update the code
// to the exact reference of the current remote.
// This is the better than using git pull because it can handle force pushed branches.
if ($git_ref_type == 'branch') {
provision_process("git reset --hard origin/{$git_ref}", d()->platform->repo_path, dt('DevShop Deploy'));
provision_process("git show", d()->platform->repo_path, dt('Post deploy git status'));
provision_process("git reset --hard origin/{$git_ref}", d()->platform->repo_path, dt('DevShop Deploy: Update code to match upstream branch.'));
}

// Run a submodule update and init.
provision_process("git submodule update --init --recursive --force ", d()->platform->repo_path, dt('DevShop Deploy'));
provision_process("git submodule update --init --recursive --force ", d()->platform->repo_path, dt('DevShop Deploy: Init Submodules'));

provision_process("git status", d()->platform->repo_path, dt('DevShop Deploy'));
provision_process("git status", d()->platform->repo_path, dt('DevShop Deploy: Git Status'));
}

/**
Expand Down

0 comments on commit b9be304

Please sign in to comment.