mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 23:43:47 +00:00 
			
		
		
		
	Fix hashing of parsed Cargo.toml (#160)
				
					
				
			The values for the dependencies could be strings intead of objects, so add a `try` block to take care of that. Also set `dep.path` to `""` if the dependency contains a key `path` to make sure that the cache isn't invalidated due to change in workspace. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
		
							parent
							
								
									4e0f4b19dd
								
							
						
					
					
						commit
						c0e052c18c
					
				
							
								
								
									
										12
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -67021,8 +67021,16 @@ class CacheConfig { | ||||
|                         const deps = parsed[section_name]; | ||||
|                         for (const key of Object.keys(deps)) { | ||||
|                             const dep = deps[key]; | ||||
|                             if ("path" in dep) { | ||||
|                                 dep.version = "0.0.0"; | ||||
|                             try { | ||||
|                                 if ("path" in dep) { | ||||
|                                     dep.version = "0.0.0"; | ||||
|                                     dep.path = ""; | ||||
|                                 } | ||||
|                             } | ||||
|                             catch (_e) { | ||||
|                                 // Not an object, probably a string (version),
 | ||||
|                                 // continue.
 | ||||
|                                 continue; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
							
								
								
									
										12
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -67021,8 +67021,16 @@ class CacheConfig { | ||||
|                         const deps = parsed[section_name]; | ||||
|                         for (const key of Object.keys(deps)) { | ||||
|                             const dep = deps[key]; | ||||
|                             if ("path" in dep) { | ||||
|                                 dep.version = "0.0.0"; | ||||
|                             try { | ||||
|                                 if ("path" in dep) { | ||||
|                                     dep.version = "0.0.0"; | ||||
|                                     dep.path = ""; | ||||
|                                 } | ||||
|                             } | ||||
|                             catch (_e) { | ||||
|                                 // Not an object, probably a string (version),
 | ||||
|                                 // continue.
 | ||||
|                                 continue; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
| @ -166,8 +166,15 @@ export class CacheConfig { | ||||
|             for (const key of Object.keys(deps)) { | ||||
|               const dep = deps[key]; | ||||
| 
 | ||||
|               if ("path" in dep) { | ||||
|                 dep.version = "0.0.0"; | ||||
|               try { | ||||
|                 if ("path" in dep) { | ||||
|                   dep.version = "0.0.0"; | ||||
|                   dep.path = ""; | ||||
|                 } | ||||
|               } catch (_e) { | ||||
|                 // Not an object, probably a string (version),
 | ||||
|                 // continue.
 | ||||
|                 continue; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user