mirror of
https://github.com/Swatinem/rust-cache.git
synced 2024-11-26 17:56:08 +08: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
8
dist/restore/index.js
vendored
8
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];
|
||||
try {
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
dep.path = "";
|
||||
}
|
||||
}
|
||||
catch (_e) {
|
||||
// Not an object, probably a string (version),
|
||||
// continue.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
8
dist/save/index.js
vendored
8
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];
|
||||
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];
|
||||
|
||||
try {
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
dep.path = "";
|
||||
}
|
||||
} catch (_e) {
|
||||
// Not an object, probably a string (version),
|
||||
// continue.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user