tools: don't parse --force as valid SHA

Closes #18929
This commit is contained in:
Jelle van der Waa 2023-07-21 18:51:50 +02:00 committed by Martin Pitt
parent 2710a26fe6
commit 3b6ac383df
1 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,12 @@ cmd_remove() {
cmd_checkout() {
# we default to check out the node_modules corresponding to the gitlink in the index
local force=""
if [ "${1-}" = "--force" ]; then
force="1"
shift
fi
local sha="${1-$(get_index_gitlink node_modules)}"
# fetch by sha to prevent us from downloading something we don't want
@ -32,7 +38,7 @@ cmd_checkout() {
# verify that our package.json is equal to the one the cached node_modules
# was created with, unless --force is given
if [ "${1-}" != "--force" ]; then
if [ -z "$force" ]; then
if ! cmp_from_cache "${sha}" '.package.json' 'package.json'; then
cat >&2 <<EOF