From ffc48178de6eee2e4efd33b4943f922475badc71 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Tue, 10 Sep 2024 15:38:55 +0300 Subject: payloads/edk2/Makefile: detect invalid commit hash on checkout There is already a check for invalid reference, however `git rev-parse reference` doesn't fail on unknown commit hash unless `^{object}` peeling operator is used (`^{commit}` can be used as well). Change-Id: I7ef39aeee2e902ac2fad6ac41b546c47418e1dec Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/84292 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- payloads/external/edk2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'payloads') diff --git a/payloads/external/edk2/Makefile b/payloads/external/edk2/Makefile index e1986239fc..6464e9f851 100644 --- a/payloads/external/edk2/Makefile +++ b/payloads/external/edk2/Makefile @@ -179,7 +179,7 @@ $(EDK2_PLATFORMS_PATH): $(WORKSPACE) git clone --recurse-submodules $(CONFIG_EDK2_PLATFORMS_REPOSITORY) $(EDK2_PLATFORMS_PATH) -j5; \ fi cd $(EDK2_PLATFORMS_PATH); \ - if ! git rev-parse --verify -q $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) >/dev/null; then \ + if ! git rev-parse --verify -q $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV)^{object} >/dev/null; then \ echo " $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) is not a valid git reference"; \ exit 1; \ fi; \ @@ -202,7 +202,7 @@ $(EDK2_PATH): $(WORKSPACE) fi; \ echo " Fetching new commits from $(CONFIG_EDK2_REPOSITORY)"; \ git fetch origin 2>/dev/null; \ - if ! git rev-parse --verify -q $(CONFIG_EDK2_TAG_OR_REV) >/dev/null; then \ + if ! git rev-parse --verify -q $(CONFIG_EDK2_TAG_OR_REV)^{object} >/dev/null; then \ echo " $(CONFIG_EDK2_TAG_OR_REV) is not a valid git reference"; \ exit 1; \ fi; \ -- cgit v1.2.3