Skip to content

Commit 76bccd6

Browse files
committed
fix: Empty repositories
Add exceptions and checks for handling completely empty repositories
1 parent 3656606 commit 76bccd6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

github2pandas/utility.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ def check_for_updates_paginated(new_paginated_list, old_df):
114114
True if it need to be updated. False the List is uptodate.
115115
116116
"""
117+
import sys
117118
if old_df.empty:
118-
if new_paginated_list.totalCount == 0:
119+
# .totalCount crashes in case of a total empty repository
120+
try:
121+
new_paginated_list.totalCount == 0
122+
except:
119123
return False
120124
return True
121125
if not new_paginated_list.totalCount == old_df.count()[0]:

github2pandas/version.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def clone_repository(repo, data_root_dir, github_token=None, new_clone=False):
134134
if (repo_dir.exists ()) & (not new_clone):
135135
old_path = Path.cwd()
136136
os.chdir(repo_dir)
137-
subprocess.check_output(["git", "pull"])
137+
try:
138+
subprocess.check_output(["git", "pull"])
139+
except:
140+
print("This repository is empty, git pull generates an error")
138141
os.chdir(old_path)
139142
return
140143

0 commit comments

Comments
 (0)