[PATCH 2/3] Throw a KeyError, not RuntimeError

Konstantin Ryabitsev <[email protected]> Fri, 7 May 2021 14:13:21 -0400
Newsgroups org.kernel.lore.signatures
Message-ID <[email protected]>
Don't die when running outside of a git checkout, just ignore ref:
keyring locations.

Signed-off-by: Konstantin Ryabitsev <[email protected]>
---
 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