mirror of
https://github.com/Swatinem/rust-cache
synced 2025-04-13 15:48:43 +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];
|
const deps = parsed[section_name];
|
||||||
for (const key of Object.keys(deps)) {
|
for (const key of Object.keys(deps)) {
|
||||||
const dep = deps[key];
|
const dep = deps[key];
|
||||||
if ("path" in dep) {
|
try {
|
||||||
dep.version = "0.0.0";
|
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];
|
const deps = parsed[section_name];
|
||||||
for (const key of Object.keys(deps)) {
|
for (const key of Object.keys(deps)) {
|
||||||
const dep = deps[key];
|
const dep = deps[key];
|
||||||
if ("path" in dep) {
|
try {
|
||||||
dep.version = "0.0.0";
|
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)) {
|
for (const key of Object.keys(deps)) {
|
||||||
const dep = deps[key];
|
const dep = deps[key];
|
||||||
|
|
||||||
if ("path" in dep) {
|
try {
|
||||||
dep.version = "0.0.0";
|
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 a new issue