From ff35a29d08103dd1c410e90b1bbe41e54e0f0e8a Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sun, 10 Mar 2024 20:54:43 -0700 Subject: [PATCH] importer: Address upstream hash ref list issue There are cases where upstream (stream 10 for example) have repos for packages that they plan or will ship, but there are no references associated. Meaning, there's no branches, there's no data, nothing to work off of. --- pv2/util/gitutil.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pv2/util/gitutil.py b/pv2/util/gitutil.py index 504d7b4..d7b75b5 100644 --- a/pv2/util/gitutil.py +++ b/pv2/util/gitutil.py @@ -139,8 +139,11 @@ def tag(repo, tag_name:str, message: str): def lsremote(url): """ - Helps check if a repo exists, and if it does, return references. If not, - return None and assume it doesn't exist. + Helps check if a repo exists. + + If repo exists: return references + If repo exists and is completely empty: return empty dict + If repo does not exist: return None """ remote_refs = {} git_cmd = rawgit.cmd.Git() @@ -153,5 +156,6 @@ def lsremote(url): for ref in git_cmd.ls_remote(url).split('\n'): hash_ref_list = ref.split('\t') - remote_refs[hash_ref_list[1]] = hash_ref_list[0] + if len(hash_ref_list) > 1: + remote_refs[hash_ref_list[1]] = hash_ref_list[0] return remote_refs