diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-15 17:10:29 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-15 17:10:29 -0300 |
commit | 886c6d1d30b6d445193a2d3379359b31b1448834 (patch) | |
tree | ce85fb8f90994f924ef25a6a11d7c1a24bb9e41e | |
parent | f235cf91ab83bc792d6a193d524a20addfeaeb9c (diff) |
yaml: report unambiguous names for resolving track rereleases
-rw-r--r-- | src/data/yaml.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js index 44bca66b..627f559c 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -1452,10 +1452,20 @@ export function filterReferenceErrors(wikiData) { // It should still be reported since the 'Originally Released As' field // was present. const original = find.track(track.originalReleaseTrackByRef, wikiData.trackData, {mode: 'quiet'}); - const shouldBeMessage = + + // Prefer references by name, but only if it's unambiguous. + const originalByName = (original + ? find.track(original.name, wikiData.trackData, {mode: 'quiet'}) + : null); + + const shouldBeMessage = + (originalByName + ? color.green(original.name) + : original ? color.green('track:' + original.directory) : color.green(track.originalReleaseTrackByRef)); + throw new Error(`Reference ${color.red(trackRef)} is to a rerelease, should be ${shouldBeMessage}`); } |