-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
271 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ php: | |
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
before_script: | ||
- curl -s https://getcomposer.org/installer | php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM php:7 | ||
|
||
RUN php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php && \ | ||
php composer-setup.php && \ | ||
php -r "unlink('composer-setup.php');" && \ | ||
mv composer.phar /usr/local/bin/composer | ||
|
||
RUN apt-get update && \ | ||
apt-get install -yqq git && \ | ||
git config --global user.email "[email protected]" && \ | ||
git config --global user.name "GitElephant tests" && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN apt-get update && \ | ||
apt-get install -yqq zlib1g-dev && \ | ||
docker-php-ext-install zip && \ | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,8 @@ | |
} | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "5.3.3" | ||
} | ||
"platform": { | ||
"php": "5.3.3" | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
git: | ||
build: . | ||
volumes: | ||
- .:/code | ||
working_dir: /code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: christian | ||
* Date: 3/2/16 | ||
* Time: 11:29 AM | ||
*/ | ||
|
||
namespace GitElephant\Command; | ||
|
||
|
||
use GitElephant\Objects\Commit; | ||
use GitElephant\Objects\TreeishInterface; | ||
use \GitElephant\Repository; | ||
|
||
class ResetCommand extends BaseCommand | ||
{ | ||
const GIT_RESET_COMMAND = 'reset'; | ||
|
||
const OPTION_HARD = '--hard'; | ||
const OPTION_MERGE = '--merge'; | ||
const OPTION_SOFT = '--soft'; | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param \GitElephant\Repository $repo The repository object this command | ||
* will interact with | ||
*/ | ||
public function __construct(Repository $repo = null) | ||
{ | ||
parent::__construct($repo); | ||
} | ||
|
||
/** | ||
* @param TreeishInterface|Commit|string $arg | ||
* @param array $options | ||
* | ||
* @throws \RuntimeException | ||
* @return string | ||
*/ | ||
public function reset($arg = null, array $options = array()) | ||
{ | ||
$this->clearAll(); | ||
$this->addCommandName(self::GIT_RESET_COMMAND); | ||
// if there are options add them. | ||
if (! is_null($options)) { | ||
foreach ($options as $option) { | ||
$this->addCommandArgument($option); | ||
} | ||
} | ||
if($arg!=null){ | ||
$this->addCommandSubject2($arg); | ||
} | ||
|
||
return $this->getCommand(); | ||
} | ||
|
||
/** | ||
* @param Repository $repository | ||
* @return ResetCommand | ||
*/ | ||
public static function getInstance(Repository $repository=null) | ||
{ | ||
return new self($repository); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: christian | ||
* Date: 3/2/16 | ||
* Time: 1:11 PM | ||
*/ | ||
|
||
namespace GitElephant\Command; | ||
|
||
use GitElephant\Objects\Commit; | ||
use \GitElephant\TestCase; | ||
|
||
class ResetCommandTest extends TestCase | ||
{ | ||
/** | ||
* setUp | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->initRepository(); | ||
$this->getRepository()->init(); | ||
$this->addFile('test'); | ||
$this->getRepository()->commit('test', true); | ||
$this->getRepository()->createBranch('test', 'master'); | ||
} | ||
|
||
public function testResetHard() | ||
{ | ||
$rstc = ResetCommand::getInstance(); | ||
$this->assertEquals("reset '--hard' 'dbeac'",$rstc->reset('dbeac',array(ResetCommand::OPTION_HARD))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.