From 2d318ab96316d7f91b151de7d495d8bc6be2f683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Thu, 6 Oct 2022 07:07:56 +0800 Subject: Add check_notes, prevent invalid signature --- git-snapsign | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'git-snapsign') diff --git a/git-snapsign b/git-snapsign index c1dce21..2643167 100755 --- a/git-snapsign +++ b/git-snapsign @@ -90,6 +90,15 @@ check_format() { fi } +check_notes() { + if ! git show-ref --quiet --verify -- "refs/notes" >/dev/null 2>&1; then + git config --add remote.origin.fetch "+refs/notes/*:refs/notes/*" >/dev/null 2>&1 + git fetch >/dev/null 2>&1 + else + git fetch >/dev/null 2>&1 + fi +} + #--------- # core #--------- @@ -135,6 +144,7 @@ while getopts ":dfPhvF:s:p:t:" opt; do keyid="$OPTARG" ;; t) + check_notes "$@" if ! git rev-parse --verify "${OPTARG}" >/dev/null 2>&1; then echo -e "fatal: failed to verify tag: ${OPTARG}" exit 1 -- cgit v1.2.3