Skip to content

Commit a49cb76

Browse files
committed
Fix
1 parent 48bdc14 commit a49cb76

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ vendor
1010
node_modules
1111
.php-cs-fixer.cache
1212
.context
13-
runtime
13+
runtime/*

runtime/php-cs-fixer.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Fetcher/Finder/CommitDiffFinder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Butschster\ContextGenerator\Fetcher\FileTreeBuilder;
1010
use Butschster\ContextGenerator\Fetcher\FilterableSourceInterface;
1111
use Butschster\ContextGenerator\Fetcher\FinderInterface;
12+
use Butschster\ContextGenerator\Fetcher\Git\CommitRangeParser;
1213
use Butschster\ContextGenerator\Source\CommitDiffSource;
1314
use Symfony\Component\Finder\Finder;
1415
use Symfony\Component\Finder\SplFileInfo;
@@ -22,6 +23,7 @@
2223
{
2324
public function __construct(
2425
private FileTreeBuilder $fileTreeBuilder = new FileTreeBuilder(),
26+
private CommitRangeParser $rangeParser = new CommitRangeParser(),
2527
) {}
2628

2729
/**
@@ -44,7 +46,7 @@ public function find(FilterableSourceInterface $source, string $basePath = ''):
4446

4547
// Get the commit range from the source
4648
// The CommitDiffSource now returns an already resolved range from the parser
47-
$commitRange = $this->formatCommitRange($source->getCommitRange());
49+
$commitRange = $this->formatCommitRange($source->commit);
4850

4951
// Get the list of changed files
5052
$changedFiles = $this->getChangedFiles($source->repository, $commitRange);
@@ -141,6 +143,8 @@ public function getContents(): string
141143
*/
142144
private function formatCommitRange(string|array $commitRange): string
143145
{
146+
$commitRange = $this->rangeParser->resolve($commitRange);
147+
144148
// Handle special cases
145149
if ($commitRange === '') {
146150
return '--cached'; // This will get unstaged changes in the index

0 commit comments

Comments
 (0)