99use Butschster \ContextGenerator \Fetcher \FileTreeBuilder ;
1010use Butschster \ContextGenerator \Fetcher \FilterableSourceInterface ;
1111use Butschster \ContextGenerator \Fetcher \FinderInterface ;
12+ use Butschster \ContextGenerator \Fetcher \Git \CommitRangeParser ;
1213use Butschster \ContextGenerator \Source \CommitDiffSource ;
1314use Symfony \Component \Finder \Finder ;
1415use Symfony \Component \Finder \SplFileInfo ;
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