diff --git a/spec/GrumPHP/Locator/ChangedFilesSpec.php b/spec/GrumPHP/Locator/ChangedFilesSpec.php index 0f2d5531d..5077825a9 100644 --- a/spec/GrumPHP/Locator/ChangedFilesSpec.php +++ b/spec/GrumPHP/Locator/ChangedFilesSpec.php @@ -4,6 +4,7 @@ use Gitonomy\Git\Diff\Diff; use Gitonomy\Git\Diff\File; +use Gitonomy\Git\WorkingCopy; use Gitonomy\Git\Repository; use PhpSpec\ObjectBehavior; use Prophecy\Argument; @@ -37,13 +38,14 @@ protected function mockFile($name, $isRename = false, $isDelete = false) return $file->reveal(); } - function it_will_list_all_diffed_files(Repository $repository, Diff $diff) + function it_will_list_all_diffed_files(Repository $repository, Diff $diff, WorkingCopy $workingCopy) { $changedFile = $this->mockFile('file1.txt'); $movedFile = $this->mockFile('file2.txt', true); $deletedFile = $this->mockFile('file3.txt', false, true); - $repository->getDiff('HEAD')->willReturn($diff); + $repository->getWorkingCopy()->willReturn($workingCopy); + $workingCopy->getDiffStaged()->willReturn($diff); $diff->getFiles()->willReturn(array($changedFile, $movedFile, $deletedFile)); $result = $this->locate(); diff --git a/src/GrumPHP/Locator/ChangedFiles.php b/src/GrumPHP/Locator/ChangedFiles.php index 6821cada3..bb046fcfb 100644 --- a/src/GrumPHP/Locator/ChangedFiles.php +++ b/src/GrumPHP/Locator/ChangedFiles.php @@ -34,7 +34,7 @@ public function __construct(Repository $repository) */ public function locate() { - $diff = $this->repository->getDiff('HEAD'); + $diff = $this->repository->getWorkingCopy()->getDiffStaged(); $files = array(); /** @var File $file */ foreach ($diff->getFiles() as $file) {