Skip to content

Commit

Permalink
Merge 7fe06df into 25195fa
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Mar 3, 2022
2 parents 25195fa + 7fe06df commit 5d73f0c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/CosyComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,11 @@ protected function commitFilesForAll(Config $config)
protected function switchBranch($branch_name)
{
$this->log('Checking out new branch: ' . $branch_name);
$this->execCommand('git checkout -b ' . $branch_name, false);
$result = $this->execCommand('git checkout -b ' . $branch_name, false);
if ($result) {
$this->log($this->getLastStdErr());
throw new \Exception(sprintf('There was an error checking out branch %s. Exit code was %d', $branch_name, $result));
}
// Make sure we do not have any uncommitted changes.
$this->execCommand('git checkout .', false);
}
Expand Down Expand Up @@ -1483,8 +1487,10 @@ protected function handleIndividualUpdates($data, $lockdata, $cdata, $one_pr_per
]);
}
$this->log('Checking out default branch - ' . $default_branch);
if ($this->execCommand('git checkout ' . $default_branch, false)) {
throw new \Exception('There was an error trying to check out the default branch');
$checkout_default_exit_code = $this->execCommand('git checkout ' . $default_branch, false);
if ($checkout_default_exit_code) {
$this->log($this->getLastStdErr());
throw new \Exception('There was an error trying to check out the default branch. The process ended with exit code ' . $checkout_default_exit_code);
}
// Also do a git checkout of the files, since we want them in the state they were on the default branch
$this->execCommand('git checkout .', false);
Expand Down

0 comments on commit 5d73f0c

Please sign in to comment.