From 80cdc566cb320bbabd0f2027239bf1e28dc39b00 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 22 Jan 2021 23:28:15 -0800 Subject: [PATCH] Handle case where new repo has no HEAD. --- gitcheckup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitcheckup.py b/gitcheckup.py index b8c582d..8947f3f 100644 --- a/gitcheckup.py +++ b/gitcheckup.py @@ -207,7 +207,11 @@ def checkup_committed(): def checkup_pushed(): details = dotdict.DotDict(default=None) - my_head = git_rev_parse('@') + try: + my_head = git_rev_parse('@') + except subprocess.CalledProcessError as exc: + details.error = 'No HEAD' + return details try: remote_head = git_rev_parse('@{u}')