File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,16 @@ endfunction()
215215# We will be able to use a shorter path with very high probability, but in the (rare) event that the
216216# first couple characters collide, we will check longer and longer substrings.
217217function (cpm_get_shortest_hash source_cache_dir origin_hash short_hash_output_var)
218+ # for compatibility with caches populated by a previous version of CPM, check if a directory using
219+ # the full hash already exists
220+ if (EXISTS "${source_cache_dir} /${origin_hash} " )
221+ set (${short_hash_output_var}
222+ "${origin_hash} "
223+ PARENT_SCOPE
224+ )
225+ return ()
226+ endif ()
227+
218228 foreach (len RANGE 4 40 4)
219229 string (SUBSTRING "${origin_hash} " 0 ${len} short_hash)
220230 set (hash_lock ${source_cache_dir} /${short_hash} .lock)
You can’t perform that action at this time.
0 commit comments