From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F23CAC43460 for ; Fri, 7 May 2021 18:13:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) id CF94961059; Fri, 7 May 2021 18:13:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 9526B61029 for ; Fri, 7 May 2021 18:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620411204; bh=fvKhG8/A9Va+icUXS3C23/XNlHNl6qQMHo14boh0Xys=; h=From:List-Id:To:Subject:Date:In-Reply-To:References:From; b=GA8YTfYDYO8x4LjGTC2/93ipc0jTWqv5507kFEtox81iFHWGVSNmeI9Pqs2O7dPJj W6KbpDTQT73HtKU1415fE9Ca8n5ecXyPAeusCeCt8d/uwndU1I6U2EImBcm5b1PyB0 4Ghei+nSArQYe4EMWLCbK7Dm6AjfO6p5K4xnTIQ0= From: Konstantin Ryabitsev List-Id: To: signatures@kernel.org Subject: [PATCH 2/3] Throw a KeyError, not RuntimeError Date: Fri, 7 May 2021 14:13:21 -0400 Message-Id: <20210507181322.172569-3-konstantin@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507181322.172569-1-konstantin@linuxfoundation.org> References: <20210507181322.172569-1-konstantin@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=927; h=from:subject; bh=fvKhG8/A9Va+icUXS3C23/XNlHNl6qQMHo14boh0Xys=; b=owGbwMvMwCG27YjM47CUmTmMp9WSGBKmNjvpMwVfNJqoqs7D2v7m5Cempw5NSm5K2+bvPa5555Rv z3LxjlIWBjEOBlkxRZayfbGbggofesil95jCzGFlAhnCwMUpABPpC2Rk2Hny7TI2v6+flc9fncZaoL T24vU+l0W7l7OLFewRX/pTW5zhn/nh/Z7d56SNWpa87GJa7JvVFs3XffA9u8Oxd+e3XVWawAIA X-Developer-Key: i=konstantin@linuxfoundation.org; a=openpgp; fpr=DE0E66E32F1FDD0902666B96E63EDCA9329DD07E Content-Transfer-Encoding: 8bit Don't die when running outside of a git checkout, just ignore ref: keyring locations. Signed-off-by: Konstantin Ryabitsev --- patatt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patatt/__init__.py b/patatt/__init__.py index e54bb10..2f380e0 100644 --- a/patatt/__init__.py +++ b/patatt/__init__.py @@ -684,7 +684,7 @@ def get_public_key(source: str, keytype: str, identity: str, selector: str) -> T if source.find('ref:') == 0: gittop = get_git_toplevel() if not gittop: - raise RuntimeError('Not in a git tree, so cannot use a ref: source') + raise KeyError('Not in a git tree, so cannot use a ref: source') # format is: ref:refspec:path # or it could omit the refspec, meaning "whatever the current ref" # but it should always have at least two ":" -- 2.31.1