From 07023fabe188046568c96980b903ac7ca1d6c1bd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 31 2016 06:21:31 +0000 Subject: Get the parent if the repo is not empty, fail otherwise This might avoid the situation where we could end-up pushing a change without a parent commit while the repo isn't new/empty and thus where we shouldn't as otherwise we loose the entire history --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 7c10aef..636ea0c 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -274,10 +274,8 @@ def clean_git(obj, repo, repofolder): # See if there is a parent to this commit parent = None - try: + if not new_repo.is_empty: parent = new_repo.head.get_object().oid - except pygit2.GitError: - pass parents = [] if parent: