summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/checkout.c b/src/checkout.c
index eff14813d..c4e4f999a 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -440,7 +440,9 @@ static int checkout_get_actions(
const git_index_entry *he;
/* if there is no HEAD, that's okay - we'll make an empty iterator */
- (void)git_repository_head_tree(&head, data->repo);
+ if (((error = git_repository_head_tree(&head, data->repo)) < 0) &&
+ !(error == GIT_ENOTFOUND || error == GIT_EORPHANEDHEAD))
+ return -1;
if ((error = git_iterator_for_tree_range(
&hiter, data->repo, head, pfx, pfx)) < 0)