Skip to content

Commit f54a545

Browse files
committed
Fix empty repository crash due to None timestamp comparison (#489)
Empty repositories have None for pushed_at/updated_at, causing a TypeError when compared to the last_update string. Use .get() with truthiness check to skip None timestamps in incremental tracking.
1 parent 6006765 commit f54a545

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

github_backup/github_backup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,9 +1772,9 @@ def backup_repositories(args, output_directory, repositories):
17721772

17731773
last_update = "0000-00-00T00:00:00Z"
17741774
for repository in repositories:
1775-
if "updated_at" in repository and repository["updated_at"] > last_update:
1775+
if repository.get("updated_at") and repository["updated_at"] > last_update:
17761776
last_update = repository["updated_at"]
1777-
elif "pushed_at" in repository and repository["pushed_at"] > last_update:
1777+
elif repository.get("pushed_at") and repository["pushed_at"] > last_update:
17781778
last_update = repository["pushed_at"]
17791779

17801780
if repository.get("is_gist"):

0 commit comments

Comments
 (0)