<commit_before><?php
/*
 * This file is part of the Magallanes package.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Mage\Task\BuiltIn\Deployment\Strategy;

use Mage\Task\Releases\IsReleaseAware;

/**
 * Task for using Git Working Copy as the Deployed Code
 *
 * @author <NAME> <<EMAIL>>
 */
class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
{
    /**
     * (non-PHPdoc)
     * @see \Mage\Task\AbstractTask::getName()
     */
    public function getName()
    {
        return 'Deploy via Git Rebase [built-in]';
    }

    /**
     * Rebases the Git Working Copy as the Deployed Code
     * @see \Mage\Task\AbstractTask::run()
     */
    public function run()
    {
        $this->checkOverrideRelease();

        if ($this->getConfig()->release('enabled', false) == true) {
            $releasesDirectory = $this->getConfig()->release('directory', 'releases');

            $deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
                . '/' . $releasesDirectory
                . '/' . $this->getConfig()->getReleaseId();
            $this->runCommandRemote('mkdir -p ' . $deployToDirectory . '/' . $this->getConfig()->getReleaseId());
        }

        $branch = $this->getParameter('branch', 'master');
        $remote = $this->getParameter('remote', 'origin');

        // Fetch Remote
        $command = $this->getReleasesAwareCommand('git fetch ' . $remote);
        $result = $this->runCommandRemote($command);

        if ($result === false) {
            $repository = $this->getConfig()->deployment('repository');
            if ($repository) {
                $command = $this->getReleasesAwareCommand('git clone ' . $repository . ' .');
                $result = $this->runCommandRemote($command);

                $command = $this->getReleasesAwareCommand('git fetch ' . $remote);
                $result = $this->runCommandRemote($command);
            }
        }<commit_msg>Fix remote deployment path for GitRebaseTask<commit_after><?php
/*
 * This file is part of the Magallanes package.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Mage\Task\BuiltIn\Deployment\Strategy;

use Mage\Task\Releases\IsReleaseAware;

/**
 * Task for using Git Working Copy as the Deployed Code
 *
 * @author <NAME> <<EMAIL>>
 */
class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
{
    /**
     * (non-PHPdoc)
     * @see \Mage\Task\AbstractTask::getName()
     */
    public function getName()
    {
        return 'Deploy via Git Rebase [built-in]';
    }

    /**
     * Rebases the Git Working Copy as the Deployed Code
     * @see \Mage\Task\AbstractTask::run()
     */
    public function run()
    {
        $this->checkOverrideRelease();

        if ($this->getConfig()->release('enabled', false) == true) {
            $releasesDirectory = $this->getConfig()->release('directory', 'releases');

            $deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
                . '/' . $releasesDirectory
                . '/' . $this->getConfig()->getReleaseId();
            $this->runCommandRemote('mkdir -p ' . $deployToDirectory);
        }

        $branch = $this->getParameter('branch', 'master');
        $remote = $this->getParameter('remote', 'origin');

        // Fetch Remote
        $command = $this->getReleasesAwareCommand('git fetch ' . $remote);
        $result = $this->runCommandRemote($command);

        if ($result === false) {
            $repository = $this->getConfig()->deployment('repository');
            if ($repository) {
                $command = $this->getReleasesAwareCommand('git clone ' . $repository . ' .');
                $result = $this->runCommandRemote($command);

                $command = $this->getReleasesAwareCommand('git fetch ' . $remote);
                $result = $this->runCommandRemote($command);
            }
        }
{'fraction_non_alphanumeric': 0.15414444983034417, 'fraction_numerical': 0.0, 'mean_word_length': 2.512340425531915, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5827537', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1136, 'n_words': 262}