Skip to content

Commit

Permalink
Fixed issue cherry picking one commit
Browse files Browse the repository at this point in the history
  • Loading branch information
divineniiquaye committed Feb 21, 2024
1 parent 8313ea0 commit 7317052
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/monorepo/src/Worker/SplitCommitsWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ static function (array $required) use ($input, $output, $currentBranch, $branche
continue;
}

$output->writeln(\sprintf('<info>Pushing (%d) commits from branch %s to %s</info>', $count, $branch, $url));
$output->writeln(\sprintf('<info>Found (%d) commits in %s:%s</info>', $count, $target, $branch));
$mainRepo->runConcurrent(0 === $updates ? [
['push', $input->getOption('force') ? '-f' : '-q', $remote, "+$target:refs/heads/$branch"],
['update-ref', '-d', $target],
] : [
['checkout', '--orphan', "split-$remote"],
['reset', '--hard'],
['pull', $remote, $branch],
['cherry-pick', ...\explode(' ', "$target~".\implode(" $target~", \array_reverse(\range(0, $count - 1))))],
['cherry-pick', ...\explode("\n", $mainRepo->run('rev-list', ["--max-count=$count", $target]))],
['push', $input->getOption('force') ? '-f' : '-q', $remote, "+refs/heads/split-$remote:$branch"],
['checkout', $currentBranch],
['branch', '-D', "split-$remote"],
Expand Down Expand Up @@ -176,6 +176,7 @@ static function (array $required) use ($input, $output, $currentBranch, $branche
if (!$input->getOption('no-push')) {
$pushChanges[] = ['push', ...($input->getOption('force') ? ['-f'] : []), 'origin', $branch];
}
$output->writeln(\sprintf('<info>Pushed (%d) commits from %s:%s</info>', $count, $url, $branch));
} else {
$output->writeln(\sprintf('<info>Nothing to commit; On branch %s, "%s/%1$s" is up to date</info>', $branch, $remote));
}
Expand Down

0 comments on commit 7317052

Please sign in to comment.