File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -149,15 +149,23 @@ public function index(): Promise
149149 $ cacheKey = null ;
150150 $ index = null ;
151151 foreach (array_merge ($ this ->composerLock ->packages , $ this ->composerLock ->{'packages-dev ' }) as $ package ) {
152- // Check if package name matches and version is absolute
153- // Dynamic constraints are not cached, because they can change every time
152+ // Check if package can be cached.
154153 $ packageVersion = ltrim ($ package ->version , 'v ' );
154+ // If package is anchored to a version
155155 if ($ package ->name === $ packageName && strpos ($ packageVersion , 'dev ' ) === false ) {
156156 $ packageKey = $ packageName . ': ' . $ packageVersion ;
157157 $ cacheKey = self ::CACHE_VERSION . ': ' . $ packageKey ;
158158 // Check cache
159159 $ index = yield $ this ->cache ->get ($ cacheKey );
160160 break ;
161+
162+ // If package is checked out
163+ } elseif ($ package ->name === $ packageName && isset ($ package ->source ->reference )) {
164+ $ packageKey = $ packageName . ': ' . $ package ->source ->reference ;
165+ $ cacheKey = self ::CACHE_VERSION . ': ' . $ packageKey ;
166+ // Check cache
167+ $ index = yield $ this ->cache ->get ($ cacheKey );
168+ break ;
161169 }
162170 }
163171 if ($ index !== null ) {
You can’t perform that action at this time.
0 commit comments